diff options
| author | John Hawthorn <john@hawthorn.email> | 2026-04-09 13:23:06 -0700 |
|---|---|---|
| committer | John Hawthorn <john@hawthorn.email> | 2026-04-09 13:55:14 -0700 |
| commit | 8aa2322bb77120ab39ee63dd27b2d17c60f919ff (patch) | |
| tree | f728b030899bf2e5f29f697a70b685d0d9801380 | |
| parent | 0b5862f4d9f6a1f86b09eadc54cafa106d996a7c (diff) | |
Add slot size assertion to ar_force_convert_table
Co-authored-by: Luke Gruber <luke.gru@gmail.com>
Co-authored-by: Matt Valentine-House <matt@eightbitraptor.com>
| -rw-r--r-- | hash.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -604,6 +604,7 @@ RHASH_AR_TABLE_SIZE_DEC(VALUE h) static inline void RHASH_AR_TABLE_CLEAR(VALUE h) { + RUBY_ASSERT(rb_gc_obj_slot_size(h) >= sizeof(struct RHash) + sizeof(ar_table)); RBASIC(h)->flags &= ~RHASH_AR_TABLE_SIZE_MASK; RBASIC(h)->flags &= ~RHASH_AR_TABLE_BOUND_MASK; @@ -719,6 +720,8 @@ ar_force_convert_table(VALUE hash, const char *file, int line) st_hash_t hashes[RHASH_AR_TABLE_MAX_SIZE]; unsigned int bound, size; + RUBY_ASSERT(rb_gc_obj_slot_size(hash) >= sizeof(struct RHash) + sizeof(ar_table)); + // prepare hash values do { st_data_t keys[RHASH_AR_TABLE_MAX_SIZE]; |
