Skip to content

Commit de0ce79

Browse files
dafedafechhagedorn
authored andcommittedDec 19, 2022
8297801: printnm crashes with invalid address due to null pointer dereference
Reviewed-by: thartmann, chagedorn, kvn
1 parent da38d43 commit de0ce79

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed
 

‎src/hotspot/share/utilities/debug.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -449,9 +449,11 @@ extern "C" JNIEXPORT void printnm(intptr_t p) {
449449
os::snprintf_checked(buffer, sizeof(buffer), "printnm: " INTPTR_FORMAT, p);
450450
Command c(buffer);
451451
CodeBlob* cb = CodeCache::find_blob((address) p);
452-
if (cb->is_nmethod()) {
452+
if (cb != NULL && cb->is_nmethod()) {
453453
nmethod* nm = (nmethod*)cb;
454454
nm->print_nmethod(true);
455+
} else {
456+
tty->print_cr("Invalid address");
455457
}
456458
}
457459

0 commit comments

Comments
 (0)