From 2967b7eb763788595fe26465881b6dfe2f580d66 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 16 Feb 2024 15:14:05 -0500 Subject: [PATCH] GC guard catch_table_ary Using RARRAY_CONST_PTR can cause the array object to not exist on the stack, which could cause it to be GC'd or be moved by GC compaction. This can cause RARRAY_CONST_PTR to point to the incorrect location if the array is embedded and moved by GC compaction. Fixes ruby/prism#2444. --- compile.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compile.c b/compile.c index 69545c87c7..7694b34bf8 100644 --- a/compile.c +++ b/compile.c @@ -1595,6 +1595,8 @@ iseq_insert_nop_between_end_and_cont(rb_iseq_t *iseq) } } } + + RB_GC_GUARD(catch_table_ary); } static int