RFR: 8346714: [ASAN] compressedKlass.cpp reported applying non-zero offset to null pointer [v4]
SendaoYan
syan at openjdk.org
Mon Dec 23 09:18:40 UTC 2024
On Mon, 23 Dec 2024 08:11:26 GMT, Thomas Stuefe <stuefe at openjdk.org> wrote:
>> SendaoYan has updated the pull request incrementally with one additional commit since the last revision:
>>
>> add function p2u and use function p2u instead of cast manually
>
> src/hotspot/share/oops/compressedKlass.cpp line 99:
>
>> 97: // Check that Klass range is fully engulfed in the encoding range
>> 98: const address encoding_start = _base;
>> 99: const address encoding_end = (address)(p2u(_base) + (uintptr_t)nth_bit(narrow_klass_pointer_bits() + _shift));
>
> nth_bit should already give us a 64-bit value, why the second cast?
> I see that nth_bit returns an intptr_t - is the sign the problem? We may want to change that to uintptr_t...
Prefer using `uintptr_t` because `intptr_t` has undefined behavior on overflow. Probably not in this case, here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/22848#discussion_r1895508997
More information about the hotspot-dev
mailing list