summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hawthorn <[email protected]>2025-06-10 11:15:47 -0700
committerJohn Hawthorn <[email protected]>2025-06-17 15:33:20 -0700
commitc6a6645495d849735132162187bd8a69c009b7c6 ()
tree3d1f09e7cd6f82e829f5d0a1ff085cea4d2d98cc
parenta7dc515c1df34c9952401cfb17d52266b7cf5534 (diff)
Fix early write barrier rb_marshal_define_compat
This write barrier occurred before the entry was added to the table, so if GC occurred when inserting into the table, the write could be missed.
Notes: Merged: https://.com/ruby/ruby/pull/13631
-rw-r--r--marshal.c6
1 files changed, 4 insertions, 2 deletions
@@ -145,12 +145,14 @@ rb_marshal_define_compat(VALUE newclass, VALUE oldclass, VALUE (*dumper)(VALUE),
compat_allocator_table();
compat = ALLOC(marshal_compat_t);
- RB_OBJ_WRITE(compat_allocator_tbl_wrapper, &compat->newclass, newclass);
- RB_OBJ_WRITE(compat_allocator_tbl_wrapper, &compat->oldclass, oldclass);
compat->dumper = dumper;
compat->loader = loader;
st_insert(compat_allocator_table(), (st_data_t)allocator, (st_data_t)compat);
}
struct dump_arg {