comparison 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
comparison
equal deleted inserted replaced
30:fd776bfc4b87 31:abcbefefa7ea
127 initialize_misc(); 127 initialize_misc();
128 128
129 if (nm == NULL && begin != NULL) { 129 if (nm == NULL && begin != NULL) {
130 // allow nmethod to be deduced from beginning address 130 // allow nmethod to be deduced from beginning address
131 CodeBlob* cb = CodeCache::find_blob(begin); 131 CodeBlob* cb = CodeCache::find_blob(begin);
132 nm = cb->as_compiled_method_or_null(); 132 nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
133 } 133 }
134 assert(nm != NULL, "must be able to deduce nmethod from other arguments"); 134 guarantee(nm != NULL, "must be able to deduce nmethod from other arguments");
135 135
136 _code = nm; 136 _code = nm;
137 _current = nm->relocation_begin() - 1; 137 _current = nm->relocation_begin() - 1;
138 _end = nm->relocation_end(); 138 _end = nm->relocation_end();
139 _addr = nm->content_begin(); 139 _addr = nm->content_begin();