mirror of
https://github.com/ruby/ruby.git
synced 2025-08-15 13:39:04 +02:00
st.c: Do not clear entries_bound when calling Hash#shift for empty hash
tab->entries_bound is used to check if the bins are full in rebuild_table_if_necessary. Hash#shift against an empty hash assigned 0 to tab->entries_bound, but didn't clear the bins. Thus, the table is not rebuilt even when the bins are full. Attempting to add a new element into full-bin hash gets stuck. This change stops clearing tab->entries_bound in Hash#shift. [Bug #18578]
This commit is contained in:
parent
8013250136
commit
496591de96
Notes:
git
2022-02-10 00:14:57 +09:00
2 changed files with 13 additions and 1 deletions
1
st.c
1
st.c
|
@ -1363,7 +1363,6 @@ st_shift(st_table *tab, st_data_t *key, st_data_t *value)
|
|||
return 1;
|
||||
}
|
||||
}
|
||||
tab->entries_start = tab->entries_bound = 0;
|
||||
if (value != 0) *value = 0;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue