RFR: 8366062: [ubsan] add non-zero offset to nullptr in cds/archiveBuilder.cpp [v3]
David Holmes
dholmes at openjdk.org
Tue Sep 9 07:21:19 UTC 2025
On Mon, 8 Sep 2025 08:44:47 GMT, Afshin Zafari <azafari at openjdk.org> wrote:
>> It is acceptable that the `SharedBaseAddress` option gets `0` at command line. The corresponding pointer arithmetic with `0` (`nullptr`) in archiveBuilder is UB.
>> Specific casts are used to avoid UBSAN error.
>>
>> Tests:
>> linux-x64-debug: tier1 passed
>
> Afshin Zafari has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains three commits:
>
> - Merge remote-tracking branch 'origin/master' into _8366062_ubsan_nullptr_plus_nz_offset
> - comments improved
> - 8366062: [ubsan] add non-zero offset to nullptr in cds/archiveBuilder.cpp
That seems fine to me. Thanks
src/hotspot/share/cds/archiveBuilder.cpp line 1113:
> 1111: address bottom = _builder->buffer_bottom();
> 1112: address top = _builder->buffer_top();
> 1113: // It is acceptable that new_bottom/new_top becomes zero.
Suggestion:
// It is acceptable that new_bottom/new_top may be zero.
-------------
Marked as reviewed by dholmes (Reviewer).
PR Review: https://git.openjdk.org/jdk/pull/26983#pullrequestreview-3199759902
PR Review Comment: https://git.openjdk.org/jdk/pull/26983#discussion_r2332272876
More information about the hotspot-runtime-dev
mailing list