summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
authorAlan Wu <[email protected]>2025-03-11 13:14:13 -0400
committerAlan Wu <[email protected]>2025-03-12 15:00:26 -0400
commit9b9661883b1e2cc85b1341d804b106885432d2bd ()
tree5467d9601a17927d235702136f38d2477e984795 /iseq.c
parenta8d63ecdb82c33744c0d1fcfa362b0c7247e83c9 (diff)
Have `ast` live longer in ISeq.compile_file to fix GC stress crash
Previously, live range of `ast_value` ended on the call right before rb_ast_dispose(), which led to premature collection and use-after-free. We observed this crashing on -O3, -DVM_CHECK_MODE, with GCC 11.4.0 on Ubuntu. Co-authored-by: Aaron Patterson <[email protected]>
Notes: Merged: https://.com/ruby/ruby/pull/12898
-rw-r--r--iseq.c1
1 files changed, 1 insertions, 0 deletions
@@ -1741,6 +1741,7 @@ iseqw_s_compile_file(int argc, VALUE *argv, VALUE self)
1, NULL, 0, ISEQ_TYPE_TOP, &option,
Qnil));
rb_ast_dispose(ast);
rb_vm_pop_frame(ec);
RB_GC_GUARD(v);