8293403: JfrResolution::on_jvmci_resolution crashes when caller is null

Reviewed-by: never
This commit is contained in:
Doug Simon 2022-09-06 15:18:02 +00:00
parent c05015bc93
commit 7c96608d9a
2 changed files with 10 additions and 2 deletions

View File

@ -127,8 +127,10 @@ void JfrResolution::on_c2_resolution(const Parse * parse, const ciKlass * holder
#if INCLUDE_JVMCI
// JVMCI
void JfrResolution::on_jvmci_resolution(const Method* caller, const Method* target, TRAPS) {
if (is_compiler_linking_event_writer(target->method_holder()->name(), target->name()) && !IS_METHOD_BLESSED(caller)) {
THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), link_error_msg);
if (is_compiler_linking_event_writer(target->method_holder()->name(), target->name())) {
if (caller == nullptr || !IS_METHOD_BLESSED(caller)) {
THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), link_error_msg);
}
}
}
#endif

View File

@ -371,6 +371,12 @@ public class TestGetEventWriter {
throw new AssertionError("Expected IllegalAccessError");
} catch (IllegalAccessError e) {
}
try {
// Test looking up with null caller
cp.lookupMethod(cpi, 184, null);
throw new AssertionError("Expected IllegalAccessError");
} catch (IllegalAccessError e) {
}
// Ignore all subsequent instructions
return;