diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-02-15 13:45:52 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-02-15 13:45:52 +0000 |
commit | 8fd5bf07581d683b32b2d24e5deedcb7e4997bbb (patch) | |
tree | 4c08d9e13ad02fb0f119d9314af8f63b8c5ef506 /st.c | |
parent | 8d532a868933f574ac9fe31ee11ead9a459b0914 (diff) | |
download | ruby-8fd5bf07581d683b32b2d24e5deedcb7e4997bbb.tar.gz |
* st.c (st_foreach): don't access ptr->hash after func call.
It may access freed area.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26672 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'st.c')
-rw-r--r-- | st.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -774,10 +774,10 @@ st_foreach(st_table *table, int (*func)(ANYARGS), st_data_t arg) 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 */ |