mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
iseq.c: Fix segfault when debug is not 0
* iseq.c (get_insn_info_succinct_bitvector): If VM_CHECK_MODE is 0, `body->insns_info.positions` is freed in `rb_iseq_insns_info_encode_positions`. Print `position` only when VM_CHECK_MODE is set. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
6f3bdbf632
commit
548896c927
1 changed files with 10 additions and 4 deletions
14
iseq.c
14
iseq.c
|
@ -1503,13 +1503,19 @@ get_insn_info_succinct_bitvector(const rb_iseq_t *iseq, size_t pos)
|
|||
const struct rb_iseq_constant_body *const body = iseq->body;
|
||||
size_t size = body->insns_info.size;
|
||||
const struct iseq_insn_info_entry *insns_info = body->insns_info.body;
|
||||
const unsigned int *positions = body->insns_info.positions;
|
||||
const int debug = 0;
|
||||
|
||||
if (debug) {
|
||||
printf("size: %"PRIuSIZE"\n", size);
|
||||
printf("insns_info[%"PRIuSIZE"]: position: %d, line: %d, pos: %"PRIuSIZE"\n",
|
||||
(size_t)0, positions[0], insns_info[0].line_no, pos);
|
||||
#if VM_CHECK_MODE > 0
|
||||
const unsigned int *positions = body->insns_info.positions;
|
||||
printf("size: %"PRIuSIZE"\n", size);
|
||||
printf("insns_info[%"PRIuSIZE"]: position: %d, line: %d, pos: %"PRIuSIZE"\n",
|
||||
(size_t)0, positions[0], insns_info[0].line_no, pos);
|
||||
#else
|
||||
printf("size: %"PRIuSIZE"\n", size);
|
||||
printf("insns_info[%"PRIuSIZE"]: line: %d, pos: %"PRIuSIZE"\n",
|
||||
(size_t)0, insns_info[0].line_no, pos);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (size == 0) {
|
||||
|
|
Loading…
Reference in a new issue