Skip to content

Commit

Permalink
JIT: Ensure no overflow in ContainBlockStoreAddress (#76532)
Browse files Browse the repository at this point in the history
The offset here can be a "base" address due to various JIT
transformations so we should ensure the range [offset, offset+size) does
not overflow.

Fix #76506
  • Loading branch information
jakobbotsch authored Oct 3, 2022
1 parent 56bbc7c commit a45611a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/coreclr/jit/lowerarmarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,12 @@ void Lowering::ContainBlockStoreAddress(GenTreeBlk* blkNode, unsigned size, GenT
{
return;
}
#endif // TARGET_ARM
#else // !TARGET_ARM
if ((ClrSafeInt<int>(offset) + ClrSafeInt<int>(size)).IsOverflow())
{
return;
}
#endif // !TARGET_ARM

if (!IsSafeToContainMem(blkNode, addr))
{
Expand Down

0 comments on commit a45611a

Please sign in to comment.