8257624: C2: PhaseMacroExpand::eliminate_macro_nodes() crashes on out-of-bounds access into macro node array

Reviewed-by: neliasso, kvn
This commit is contained in:
Vladimir Ivanov 2020-12-04 09:37:18 +00:00
parent fd6756ee2b
commit fbdc1877e2

View File

@ -2564,6 +2564,9 @@ void PhaseMacroExpand::eliminate_macro_nodes() {
while (progress) {
progress = false;
for (int i = C->macro_count(); i > 0; i--) {
if (i > C->macro_count()) {
i = C->macro_count(); // more than 1 element can be eliminated at once
}
Node* n = C->macro_node(i-1);
bool success = false;
DEBUG_ONLY(int old_macro_count = C->macro_count();)
@ -2580,6 +2583,9 @@ void PhaseMacroExpand::eliminate_macro_nodes() {
while (progress) {
progress = false;
for (int i = C->macro_count(); i > 0; i--) {
if (i > C->macro_count()) {
i = C->macro_count(); // more than 1 element can be eliminated at once
}
Node* n = C->macro_node(i-1);
bool success = false;
DEBUG_ONLY(int old_macro_count = C->macro_count();)