RFR: 8345569: [ubsan] filemap.cpp:2215:47: runtime error: applying non-zero offset 34358689792 to null pointer

David Holmes dholmes at openjdk.org
Mon Dec 9 12:36:40 UTC 2024


On Mon, 9 Dec 2024 08:15:17 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

>> src/hotspot/share/cds/filemap.cpp line 2248:
>> 
>>> 2246:     // the value P can remain 0x1200. The decoded address = (0x4000 + (0x1200 << 0)) = 0x5200,
>>> 2247:     // which is the runtime location of the referenced object.
>>> 2248:     return /*runtime*/ (address)((uintptr_t)CompressedOops::base() + r->mapping_offset());
>> 
>> If `base()` can return 0 (nullptr) then how does the casting help with the warning?
>
> I think the addition on uintptr_t is defined in C++ while the addition on nullptr is not.
> That's why the ubsan warning/error goes away.

Ah I misread the placement of the parentheses.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/22603#discussion_r1875907879


More information about the hotspot-runtime-dev mailing list