RFR: 8339242: Fix overflow issues in AdlArena

Dean Long dlong at openjdk.org
Fri Aug 30 23:38:28 UTC 2024


On Thu, 29 Aug 2024 15:07:46 GMT, Casper Norrbin <duke at openjdk.org> wrote:

> Hi everyone,
> 
> This PR addresses an issue in `adlArena` where some allocations lack checks for overflow. This could potentially result in successful allocations when called with unrealistic values.
> 
> The fix includes:
> 
> - Adding assertions to check for potential overflow.
> - Reordering some operations to guard against overflow.

src/hotspot/share/adlc/adlArena.cpp line 154:

> 152:   if( (c_old+old_size == _hwm) &&            // Adjusting recent thing
> 153:       ((size_t)(_max-c_old) >= new_size) ) { // Still fits where it sits, safe from overflow
> 154: 

This code appears to be a copy of Arena::Arealloc, so we should probably fix both at the same time.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/20774#discussion_r1739516231


More information about the hotspot-compiler-dev mailing list