diff options
author | Koichi Sasada <ko1@atdot.net> | 2020-03-07 03:55:54 +0900 |
---|---|---|
committer | NARUSE, Yui <naruse@airemix.jp> | 2020-03-26 21:18:26 +0900 |
commit | 897d4e31b0e5b29405480ed3236bc8c5c6cac3fa (patch) | |
tree | b89529b77170a0fdfb46297a8ac5b8b79eab8cb9 | |
parent | ab6f78bc926f6fc12dc8d7846056fc9c04d63ead (diff) |
check ar_table first.
RHASH_AR_TABLE_SIZE() has assertion that it is a ar_talbe.
The last commit breaks this assumption so check ar_table first.
(cherry picked from commit c3584dfacce4d0f2058d8403de6fdce4fd4d686b)
-rw-r--r-- | hash.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -747,11 +747,14 @@ ar_free_and_clear_table(VALUE hash) static void ar_try_convert_table(VALUE hash) { - st_table *new_tab; + if (!RHASH_AR_TABLE_P(hash)) return; + const unsigned size = RHASH_AR_TABLE_SIZE(hash); + + st_table *new_tab; st_index_t i; - if (!RHASH_AR_TABLE_P(hash) || size < RHASH_AR_TABLE_MAX_SIZE) { + if (size < RHASH_AR_TABLE_MAX_SIZE) { return; } |