summaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorAaron Patterson <tenderlove@ruby-lang.org>2019-08-16 16:04:26 -0700
committerAaron Patterson <tenderlove@ruby-lang.org>2019-08-27 11:43:18 -0700
commit932a471d3811d6d44764ce42b1b140a04961a763 (patch)
treed1cf0f163939dee99c623f1a14cfc433103038ec /parse.y
parentcbcad66741507daea5f5037510404848720e347f (diff)
Directly mark compile options from the AST object
`rb_ast_t` holds a reference to this object, so it should mark the object. Currently it is relying on the `mark_ary` on `node_buffer` to ensure that the object stays alive. But since the array internals can move, this could cause a segv if compaction impacts the array.
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y3
1 files changed, 1 insertions, 2 deletions
diff --git a/parse.y b/parse.y
index 0edbc565a4..ade2e0a941 100644
--- a/parse.y
+++ b/parse.y
@@ -5807,9 +5807,8 @@ yycompile0(VALUE arg)
if (!opt) opt = rb_obj_hide(rb_ident_hash_new());
rb_hash_aset(opt, rb_sym_intern_ascii_cstr("coverage_enabled"), cov);
prelude = block_append(p, p->eval_tree_begin, body);
- add_mark_object(p, opt);
tree->nd_body = prelude;
- p->ast->body.compile_option = opt;
+ RB_OBJ_WRITE(p->ast, &p->ast->body.compile_option, opt);
}
p->ast->body.root = tree;
p->ast->body.line_count = p->line_count;