diff options
author | nagachika <nagachika@ruby-lang.org> | 2020-07-19 11:56:32 +0900 |
---|---|---|
committer | nagachika <nagachika@ruby-lang.org> | 2020-07-19 11:56:32 +0900 |
commit | f43b8c4f7304ebea91cd01d5606e13273d0fd755 (patch) | |
tree | 42fdfc9bd766072af3efb76fe345da1a277b3e68 /compile.c | |
parent | e619178e52250ceda3a0fe32ff5addb16617b58c (diff) |
merge revision(s) 0ba27259d390e902139c0e2e94b9d18ef227748e: [Backport #16940]
Fix crashes in the peephole optimizer on OpenBSD/sparc64
These crashes are due to alignment issues, casting ADJUST to INSN
and then accessing after the end of the ADJUST. These patches
come from Stefan Sperling <stsp@apache.org>, who reported the
issue.
Diffstat (limited to 'compile.c')
-rw-r--r-- | compile.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -2719,7 +2719,8 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal ELEM_REMOVE(&iobj->link); return COMPILE_OK; } - else if (iobj != diobj && IS_INSN_ID(diobj, jump) && + else if (iobj != diobj && IS_INSN(&diobj->link) && + IS_INSN_ID(diobj, jump) && OPERAND_AT(iobj, 0) != OPERAND_AT(diobj, 0)) { /* * useless jump elimination: @@ -2897,7 +2898,7 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal } for (;;) { - if (IS_INSN_ID(nobj, jump)) { + if (IS_INSN(&nobj->link) && IS_INSN_ID(nobj, jump)) { replace_destination(iobj, nobj); } else if (prev_dup && IS_INSN_ID(nobj, dup) && |