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

Martin Doerr mdoerr at openjdk.org
Tue May 7 08:34:57 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`.

This pull request has now been integrated.

Changeset: 23a72a1f
Author:    Martin Doerr <mdoerr at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/23a72a1f2f651d5e8e9a0eb1e75e2b44572a13da
Stats:     7 lines in 1 file changed: 0 ins; 4 del; 3 mod

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

Reviewed-by: mbaesken, stefank

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

PR: https://git.openjdk.org/jdk/pull/19087


More information about the hotspot-dev mailing list