diff options
author | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2022-09-17 20:19:57 +1200 |
---|---|---|
committer | Samuel Williams <samuel.williams@oriontransfer.co.nz> | 2022-09-22 22:19:12 +1200 |
commit | 9434a7333c2a23c680a977331a60ca7c502c1ac0 (patch) | |
tree | a0715dd55cdab3816b7065a56815017d2d0139c6 /compile.c | |
parent | 4c37eaa979d89be14c2142659daba0588aa64912 (diff) |
Enable coverage for eval.
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6396
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -2308,9 +2308,9 @@ iseq_set_sequence(rb_iseq_t *iseq, LINK_ANCHOR *const anchor) if (ISEQ_COVERAGE(iseq)) { if (ISEQ_LINE_COVERAGE(iseq) && (events & RUBY_EVENT_COVERAGE_LINE) && !(rb_get_coverage_mode() & COVERAGE_TARGET_ONESHOT_LINES)) { - int line = iobj->insn_info.line_no; - if (line >= 1) { - RARRAY_ASET(ISEQ_LINE_COVERAGE(iseq), line - 1, INT2FIX(0)); + int line = iobj->insn_info.line_no - 1; + if (line >= 0 && line < RARRAY_LEN(ISEQ_LINE_COVERAGE(iseq))) { + RARRAY_ASET(ISEQ_LINE_COVERAGE(iseq), line, INT2FIX(0)); } } if (ISEQ_BRANCH_COVERAGE(iseq) && (events & RUBY_EVENT_COVERAGE_BRANCH)) { |