From f43b8c4f7304ebea91cd01d5606e13273d0fd755 Mon Sep 17 00:00:00 2001 From: nagachika Date: Sun, 19 Jul 2020 11:56:32 +0900 Subject: 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 , who reported the issue. --- compile.c | 5 +++-- version.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/compile.c b/compile.c index 7043ba9a73..15b7076344 100644 --- a/compile.c +++ b/compile.c @@ -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) && diff --git a/version.h b/version.h index eb934969c0..ad01425605 100644 --- a/version.h +++ b/version.h @@ -2,7 +2,7 @@ # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR #define RUBY_VERSION_TEENY 1 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 95 +#define RUBY_PATCHLEVEL 96 #define RUBY_RELEASE_YEAR 2020 #define RUBY_RELEASE_MONTH 7 -- cgit v1.2.3