8169551: Segfaults in error traces when module version is null
Summary: Make sure module->version() is not null before dereferencing it.
Reviewed-by: coleenp, gtriantafill, lfoltan
--- a/hotspot/src/share/vm/runtime/frame.cpp Tue Nov 15 15:30:03 2016 +0300
+++ b/hotspot/src/share/vm/runtime/frame.cpp Tue Nov 15 08:34:56 2016 -0500
@@ -664,8 +664,10 @@
if (module->is_named()) {
module->name()->as_C_string(buf, buflen);
st->print(" %s", buf);
- module->version()->as_C_string(buf, buflen);
- st->print("@%s", buf);
+ if (module->version() != NULL) {
+ module->version()->as_C_string(buf, buflen);
+ st->print("@%s", buf);
+ }
}
} else {
st->print("j " PTR_FORMAT, p2i(pc()));
@@ -694,8 +696,10 @@
if (module->is_named()) {
module->name()->as_C_string(buf, buflen);
st->print(" %s", buf);
- module->version()->as_C_string(buf, buflen);
- st->print("@%s", buf);
+ if (module->version() != NULL) {
+ module->version()->as_C_string(buf, buflen);
+ st->print("@%s", buf);
+ }
}
st->print(" (%d bytes) @ " PTR_FORMAT " [" PTR_FORMAT "+" INTPTR_FORMAT "]",
m->code_size(), p2i(_pc), p2i(_cb->code_begin()), _pc - _cb->code_begin());