1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Store the dup'd CDHASH in the object list during IBF load

Since b2fc592c30 nothing was holding a reference to the dup'd CDHASH
during IBF loading.  If a GC happened to run during IBF load then the
copied hash wouldn't have anything to keep it alive.  We don't really
want to keep the originally loaded CDHASH hash, so this patch just
overwrites the original hash with the copied / modified hash.

[Bug #17984] [ruby-core:104259]
This commit is contained in:
Aaron Patterson 2021-07-06 15:11:49 -07:00 committed by Aaron Patterson
parent 91258ed449
commit 2599d1a8df
Notes: git 2021-07-07 09:49:11 +09:00

View file

@ -10797,6 +10797,11 @@ ibf_load_code(const struct ibf_load *load, rb_iseq_t *iseq, ibf_offset_t bytecod
rb_hash_rehash(v); // hash function changed
freeze_hide_obj(v);
// Overwrite the existing hash in the object list. This
// is to keep the object alive during load time.
// [Bug #17984] [ruby-core:104259]
pinned_list_store(load->current_buffer->obj_list, (long)op, v);
code[code_index] = v;
RB_OBJ_WRITTEN(iseqv, Qundef, v);
FL_SET(iseqv, ISEQ_MARKABLE_ISEQ);