1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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.
This commit is contained in:
Jeremy Evans 2020-03-12 15:34:45 -07:00
parent 711031de68
commit 0ba27259d3
Notes: git 2020-06-09 03:11:58 +09:00

View file

@ -2776,7 +2776,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:
@ -2954,7 +2955,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) &&