check modifcation whil ar->st

* delete `ar_try_convert` but use `ar_force_convert_table`
  to make program simple.
* `ar_force_convert_table` checks hash modification while
  calling `#hash` method with the following strategy:

1. copy keys (and vals) of ar_table
2. calc hashes from keys
3. check copied keys and hash's keys. if not matched, repeat from 1

fix [Bug #20050]
This commit is contained in:
Koichi Sasada 2023-12-15 03:42:40 +09:00
parent 29e99c84ae
commit 7ba2506232
3 changed files with 62 additions and 39 deletions

7
st.c
View file

@ -1173,6 +1173,13 @@ st_add_direct_with_hash(st_table *tab,
}
}
void
rb_st_add_direct_with_hash(st_table *tab,
st_data_t key, st_data_t value, st_hash_t hash)
{
st_add_direct_with_hash(tab, key, value, hash);
}
/* Insert (KEY, VALUE) into table TAB. The table should not have
entry with KEY before the insertion. */
void