Skip to content

Commit

Permalink
8257624: C2: PhaseMacroExpand::eliminate_macro_nodes() crashes on out…
Browse files Browse the repository at this point in the history
…-of-bounds access into macro node array

Reviewed-by: neliasso, kvn
  • Loading branch information
Vladimir Ivanov committed Dec 4, 2020
1 parent fd6756e commit fbdc187
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/hotspot/share/opto/macro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2564,7 +2564,10 @@ void PhaseMacroExpand::eliminate_macro_nodes() {
while (progress) {
progress = false;
for (int i = C->macro_count(); i > 0; i--) {
Node * n = C->macro_node(i-1);
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();)
if (n->is_AbstractLock()) {
Expand All @@ -2580,7 +2583,10 @@ void PhaseMacroExpand::eliminate_macro_nodes() {
while (progress) {
progress = false;
for (int i = C->macro_count(); i > 0; i--) {
Node * n = C->macro_node(i-1);
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();)
switch (n->class_id()) {
Expand Down

1 comment on commit fbdc187

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.