summaryrefslogtreecommitdiff
path: root/iseq.c
diff options
context:
space:
mode:
authoryui-knk <[email protected]>2024-06-29 14:05:05 +0900
committerYuichiro Kaneko <[email protected]>2024-06-30 09:20:38 +0900
commit9d76a0ab4a582d6fefbc50a7d87a68ce86cf9c56 ()
tree90982d4c8743ea65a560481d3ca3472d2954decf /iseq.c
parenta2c27bae9653a817b4e5f699f421836f8f97410b (diff)
Add RB_GC_GUARD for ast_value
I think this change fixes the following assertion failure: ``` [BUG] unexpected rb_parser_ary_data_type (2114076960) for script lines ``` It seems that `ast_value` is collected then `rb_parser_build_script_lines_from` touches invalid memory address. This change prevents `ast_value` from being collected by RB_GC_GUARD.
-rw-r--r--iseq.c3
1 files changed, 2 insertions, 1 deletions
@@ -971,7 +971,7 @@ iseq_translate(rb_iseq_t *iseq)
}
rb_iseq_t *
-rb_iseq_new_with_opt(const VALUE ast_value, VALUE name, VALUE path, VALUE realpath,
int first_lineno, const rb_iseq_t *parent, int isolated_depth,
enum rb_iseq_type type, const rb_compile_option_t *option,
VALUE script_lines)
@@ -1004,6 +1004,7 @@ rb_iseq_new_with_opt(const VALUE ast_value, VALUE name, VALUE path, VALUE realpa
rb_iseq_compile_node(iseq, node);
finish_iseq_build(iseq);
return iseq_translate(iseq);
}