diff src/share/vm/code/relocInfo.cpp @ 13459:63ac6d565c21

8180813: Null pointer dereference of CodeCache::find_blob() result Summary: Fixed missing null checks on the result of CodeCache::find_blob() found by Parfait. Reviewed-by: shade, kvn
author thartmann
date Wed, 24 May 2017 16:53:58 +0200
parents 777aaa19c4b1
children
line wrap: on
line diff
--- a/src/share/vm/code/relocInfo.cpp	Mon May 22 15:28:12 2017 -0700
+++ b/src/share/vm/code/relocInfo.cpp	Wed May 24 16:53:58 2017 +0200
@@ -129,9 +129,9 @@
   if (nm == NULL && begin != NULL) {
     // allow nmethod to be deduced from beginning address
     CodeBlob* cb = CodeCache::find_blob(begin);
-    nm = cb->as_compiled_method_or_null();
+    nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
   }
-  assert(nm != NULL, "must be able to deduce nmethod from other arguments");
+  guarantee(nm != NULL, "must be able to deduce nmethod from other arguments");
 
   _code    = nm;
   _current = nm->relocation_begin() - 1;