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

View file

@ -107,6 +107,7 @@ nonempty_memcpy(void *dest, const void *src, size_t n)
#define st_get_key rb_parser_st_get_key
#undef st_add_direct
#define st_add_direct rb_parser_st_add_direct
#define rb_st_add_direct_with_hash rb_parser_st_add_direct_with_hash
#undef st_insert2
#define st_insert2 rb_parser_st_insert2
#undef st_replace