aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornagachika <nagachika@ruby-lang.org>2020-07-19 11:56:32 +0900
committernagachika <nagachika@ruby-lang.org>2020-07-19 11:56:32 +0900
commitf43b8c4f7304ebea91cd01d5606e13273d0fd755 (patch)
tree42fdfc9bd766072af3efb76fe345da1a277b3e68
parente619178e52250ceda3a0fe32ff5addb16617b58c (diff)
downloadruby-f43b8c4f7304ebea91cd01d5606e13273d0fd755.tar.gz
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.
-rw-r--r--compile.c5
-rw-r--r--version.h2
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