ruby-changes:51206
From: yui-knk <ko1@a...>
Date: Sun, 13 May 2018 21:31:50 +0900 (JST)
Subject: [ruby-changes:51206] yui-knk:r63413 (trunk): compile.c: Fix segfault when VM_INSN_INFO_TABLE_IMPL is not 2
yui-knk 2018-05-13 21:31:38 +0900 (Sun, 13 May 2018) New Revision: 63413 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63413 Log: compile.c: Fix segfault when VM_INSN_INFO_TABLE_IMPL is not 2 * compile.c (ibf_dump_iseq_each): Fix a range of a conditional. `positions` is only used when VM_INSN_INFO_TABLE_IMPL is 2. And always `dump_body` is expected to be initialized by `iseq->body`. For example, `dump_body->insns_info.size` is used in `ibf_dump_insns_info_positions`. Modified files: trunk/compile.c Index: compile.c =================================================================== --- compile.c (revision 63412) +++ compile.c (revision 63413) @@ -8900,10 +8900,10 @@ static ibf_offset_t https://github.com/ruby/ruby/blob/trunk/compile.c#L8900 ibf_dump_iseq_each(struct ibf_dump *dump, const rb_iseq_t *iseq) { struct rb_iseq_constant_body dump_body; - unsigned int *positions; #if VM_INSN_INFO_TABLE_IMPL == 2 - dump_body = *iseq->body; + unsigned int *positions; #endif + dump_body = *iseq->body; dump_body.location.pathobj = ibf_dump_object(dump, dump_body.location.pathobj); /* TODO: freeze */ dump_body.location.base_label = ibf_dump_object(dump, dump_body.location.base_label); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/