RFR: 8366062: [ubsan] add non-zero offset to nullptr in cds/archiveBuilder.cpp [v6]

Afshin Zafari azafari at openjdk.org
Fri Oct 31 11:31:05 UTC 2025


On Fri, 31 Oct 2025 01:31:42 GMT, Ioi Lam <iklam at openjdk.org> wrote:

>> I see.
>
> Now I understand what's going on here. When the asan failure happens, the value of `_buffer_to_requested_delta` is `0 - (intptr_t)bottom`
> 
> 
> address new_bottom = bottom + _buffer_to_requested_delta;
> 
> 
> So I think it's OK to change the above line to
> 
> 
> address new_bottom = (address)((intx)bottom + _buffer_to_requested_delta);
> 
> 
> Your other changes use `uintptr_t`, but here `_buffer_to_requested_delta` can be positive or negative. It has the `intx` type, so we should do the `(intx)` type cast.
> 
> The next line doesn't need to be changed, as neither `top` nor `new_top` will be zeros.
> 
> 
> address new_top = top + _buffer_to_requested_delta;

Thanks for your suggestions. They work fine.
Done.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26983#discussion_r2481112668


More information about the hotspot-runtime-dev mailing list