8345390: [ubsan] systemDictionaryShared.cpp:964: member call on null pointer

Reviewed-by: mbaesken, kbarrett
This commit is contained in:
Ioi Lam 2024-12-09 20:35:54 +00:00
parent eff20a38c7
commit 0b9e749f54
2 changed files with 10 additions and 3 deletions

View File

@ -957,11 +957,17 @@ InstanceKlass* SystemDictionaryShared::get_shared_lambda_proxy_class(InstanceKla
Symbol* method_type,
Method* member_method,
Symbol* instantiated_method_type) {
assert(caller_ik != nullptr, "sanity");
assert(invoked_name != nullptr, "sanity");
assert(invoked_type != nullptr, "sanity");
assert(method_type != nullptr, "sanity");
assert(instantiated_method_type != nullptr, "sanity");
if (!caller_ik->is_shared() ||
!invoked_name->is_shared() ||
!invoked_type->is_shared() ||
!method_type->is_shared() ||
!member_method->is_shared() ||
(member_method != nullptr && !member_method->is_shared()) ||
!instantiated_method_type->is_shared()) {
// These can't be represented as u4 offset, but we wouldn't have archived a lambda proxy in this case anyway.
return nullptr;

View File

@ -61,13 +61,14 @@ public class LambdaInvokeVirtual {
.setArchiveName(archiveName);
CDSTestUtils.createArchiveAndCheck(opts);
// run with archive
// run with archive; make sure the lambda is loaded from the archive
CDSOptions runOpts = (new CDSOptions())
.addPrefix("-cp", appJar)
.addPrefix("-cp", appJar, "-Xlog:class+load")
.setArchiveName(archiveName)
.setUseVersion(false)
.addSuffix(mainClass);
OutputAnalyzer output = CDSTestUtils.runWithArchive(runOpts);
output.shouldMatch("LambdaInvokeVirtualApp[$][$]Lambda/.*source: shared objects file");
output.shouldHaveExitValue(0);
}
}