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

Matthias Baesken mbaesken at openjdk.org
Fri May 3 14:15:51 UTC 2024


On Fri, 3 May 2024 14:01:34 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`.

Marked as reviewed by mbaesken (Reviewer).

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

PR Review: https://git.openjdk.org/jdk/pull/19087#pullrequestreview-2038247954


More information about the hotspot-dev mailing list