8169551: Segfaults in error traces when module version is null
authorhseigel
Tue, 15 Nov 2016 08:34:56 -0500
changeset 42569 fccb65782775
parent 42568 3b30bdfe90d3
child 42570 5a4f3339b5d9
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
hotspot/src/share/vm/runtime/frame.cpp
--- 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());