Skip to content

Commit

Permalink
Merge pull request #10163 from aviansie-ben/arraycopybndchk-security-fix
Browse files Browse the repository at this point in the history
(0.21.0) Fix Power ArrayCopyBNDCHK handling of negative constants
  • Loading branch information
pshipton authored Jul 14, 2020
2 parents 84e312f + b0e8e40 commit 34cf4c0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions runtime/compiler/p/codegen/J9TreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2489,7 +2489,7 @@ TR::Register *J9::Power::TreeEvaluator::ArrayCopyBNDCHKEvaluator(TR::Node *node,
{
gcPoint = generateLabelInstruction(cg, TR::InstOpCode::bl, node, snippetLabel);
}
else if (firstChild->getOpCode().isLoadConst() && firstChild->getInt() <= UPPER_IMMED && firstChild->getRegister() == NULL)
else if (firstChild->getOpCode().isLoadConst() && firstChild->getInt() >= LOWER_IMMED && firstChild->getInt() <= UPPER_IMMED && firstChild->getRegister() == NULL)
{
TR::Register *copyIndexReg = cg->evaluate(secondChild);
if (noTrap)
Expand All @@ -2508,7 +2508,7 @@ TR::Register *J9::Power::TreeEvaluator::ArrayCopyBNDCHKEvaluator(TR::Node *node,
else
{
TR::Register *boundReg = cg->evaluate(firstChild);
if (secondChild->getOpCode().isLoadConst() && secondChild->getInt() <= UPPER_IMMED)
if (secondChild->getOpCode().isLoadConst() && secondChild->getInt() >= LOWER_IMMED && secondChild->getInt() <= UPPER_IMMED)
{
if (noTrap)
{
Expand Down

0 comments on commit 34cf4c0

Please sign in to comment.