ruby-changes:14810
From: akr <ko1@a...>
Date: Mon, 15 Feb 2010 22:49:16 +0900 (JST)
Subject: [ruby-changes:14810] Ruby:r26672 (trunk): * st.c (st_foreach): don't access ptr->hash after func call.
akr 2010-02-15 22:45:52 +0900 (Mon, 15 Feb 2010) New Revision: 26672 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26672 Log: * st.c (st_foreach): don't access ptr->hash after func call. It may access freed area. Modified files: trunk/ChangeLog trunk/st.c Index: ChangeLog =================================================================== --- ChangeLog (revision 26671) +++ ChangeLog (revision 26672) @@ -1,3 +1,8 @@ +Mon Feb 15 22:45:26 2010 Tanaka Akira <akr@f...> + + * st.c (st_foreach): don't access ptr->hash after func call. + It may access freed area. + Mon Feb 15 22:25:16 2010 Tanaka Akira <akr@f...> * ext/zlib/zlib.c (zlib_mem_alloc): suppress valgrind warnings. Index: st.c =================================================================== --- st.c (revision 26671) +++ st.c (revision 26672) @@ -774,10 +774,10 @@ if ((ptr = table->head) != 0) { do { + i = ptr->hash % table->num_bins; retval = (*func)(ptr->key, ptr->record, arg); switch (retval) { case ST_CHECK: /* check if hash is modified during iteration */ - i = ptr->hash % table->num_bins; for (tmp = table->bins[i]; tmp != ptr; tmp = tmp->next) { if (!tmp) { /* call func with error notice */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/