RFR: 8331626: unsafe.cpp:162:38: runtime error in index_oop_from_field_offset_long - applying non-zero offset 4563897424 to null pointer [v2]

Martin Doerr mdoerr at openjdk.org
Tue May 7 08:34:56 UTC 2024


On Mon, 6 May 2024 09:42:20 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:

>> `index_oop_from_field_offset_long` is sometimes used to access an absolute address by using `p == nullptr`. Unfortunately, `nullptr + byte_offset` implies undefined behavior and should better get fixed. UBSan complains about it (see JBS issue).
>> A possible solution is to replace pointer arithmetic by integer arithmetic. We can use unsigned because `assert_field_offset_sane` checks that `byte_offset >= 0`.
>
> Martin Doerr has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Change coding style.

Thanks for the reviews!

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

PR Comment: https://git.openjdk.org/jdk/pull/19087#issuecomment-2097744567


More information about the hotspot-dev mailing list