RFR: 8333730: ubsan: FieldIndices/libFieldIndicesTest.cpp:276:11: runtime error: null pointer passed as argument 2, which is declared to never be null

Chris Plummer cjplummer at openjdk.org
Tue Jun 11 17:29:14 UTC 2024


On Tue, 11 Jun 2024 13:00:44 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

> When running HS :tier1 tests with ubsan-enabled binaries, the following issue is reported :
> test
> serviceability/jvmti/FollowReferences/FieldIndices/FieldIndicesTest.jtr
> 
> test/hotspot/jtreg/serviceability/jvmti/FollowReferences/FieldIndices/libFieldIndicesTest.cpp:276:11: runtime error: null pointer passed as argument 2, which is declared to never be null
>     #0 0x7efea442e379 in Klass::explore_interfaces(JNIEnv_*) test/hotspot/jtreg/serviceability/jvmti/FollowReferences/FieldIndices/libFieldIndicesTest.cpp:276
>     #1 0x7efea443280d in Klass::explore(JNIEnv_*, _jclass*) test/hotspot/jtreg/serviceability/jvmti/FollowReferences/FieldIndices/libFieldIndicesTest.cpp:322
>     #2 0x7efea4433adf in Object::explore(JNIEnv_*, _jobject*) test/hotspot/jtreg/serviceability/jvmti/FollowReferences/FieldIndices/libFieldIndicesTest.cpp:349
>     #3 0x7efea443443b in Java_FieldIndicesTest_prepare test/hotspot/jtreg/serviceability/jvmti/FollowReferences/FieldIndices/libFieldIndicesTest.cpp:489
>     #4 0x7efe7f8d1e7b (<unknown module>)

Marked as reviewed by cjplummer (Reviewer).

test/hotspot/jtreg/serviceability/jvmti/FollowReferences/FieldIndices/libFieldIndicesTest.cpp line 278:

> 276:     if (super_klass->interfaces != nullptr) {
> 277:       memcpy(interfaces, super_klass->interfaces, sizeof(Klass*) * super_klass->interface_count);
> 278:     }

Looks good. I suppose the other approach would be to check if `interface_count == 0`. I'm not sure there is a reason to prefer one solution over the other.

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

PR Review: https://git.openjdk.org/jdk/pull/19657#pullrequestreview-2111059926
PR Review Comment: https://git.openjdk.org/jdk/pull/19657#discussion_r1635247789


More information about the serviceability-dev mailing list