Skip to content

Commit

Permalink
Return NULL if the node extensions doesn't have 5 elements
Browse files Browse the repository at this point in the history
The check is needed because simply returning 5th element could result
in garbage being returned as pinning array pointer. Returning non null
pinning array pointer when it wasn't set can lead to runtime failures.

Signed-off-by: Shubham Verma <shubhamv.sv@gmail.com>
  • Loading branch information
VermaSh committed Aug 8, 2024
1 parent 08e97ee commit 1fa94fd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/il/OMRNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5214,7 +5214,7 @@ OMR::Node::getPinningArrayPointer()
if (self()->getOpCode().hasPinningArrayPointer())
return _unionPropertyA._pinningArrayPointer;

return _unionBase._extension.getExtensionPtr()->getElem<TR::AutomaticSymbol *>(5);
return _unionBase._extension.getNumElems() >= 6 ? _unionBase._extension.getExtensionPtr()->getElem<TR::AutomaticSymbol *>(5) : NULL;
}

TR::AutomaticSymbol*
Expand Down

0 comments on commit 1fa94fd

Please sign in to comment.