提交 2f6ec9b1 编写于 作者: T thartmann

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
上级 af675702
...@@ -128,9 +128,9 @@ void RelocIterator::initialize(nmethod* nm, address begin, address limit) { ...@@ -128,9 +128,9 @@ void RelocIterator::initialize(nmethod* nm, address begin, address limit) {
if (nm == NULL && begin != NULL) { if (nm == NULL && begin != NULL) {
// allow nmethod to be deduced from beginning address // allow nmethod to be deduced from beginning address
CodeBlob* cb = CodeCache::find_blob(begin); CodeBlob* cb = CodeCache::find_blob(begin);
nm = cb->as_nmethod_or_null(); nm = (cb != NULL) ? cb->as_nmethod_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; _code = nm;
_current = nm->relocation_begin() - 1; _current = nm->relocation_begin() - 1;
......
...@@ -546,7 +546,7 @@ address SharedRuntime::get_poll_stub(address pc) { ...@@ -546,7 +546,7 @@ address SharedRuntime::get_poll_stub(address pc) {
CodeBlob *cb = CodeCache::find_blob(pc); CodeBlob *cb = CodeCache::find_blob(pc);
// Should be an nmethod // Should be an nmethod
assert( cb && cb->is_nmethod(), "safepoint polling: pc must refer to an nmethod" ); guarantee(cb != NULL && cb->is_nmethod(), "safepoint polling: pc must refer to an nmethod");
// Look up the relocation information // Look up the relocation information
assert( ((nmethod*)cb)->is_at_poll_or_poll_return(pc), assert( ((nmethod*)cb)->is_at_poll_or_poll_return(pc),
...@@ -1709,7 +1709,7 @@ IRT_LEAF(void, SharedRuntime::fixup_callers_callsite(Method* method, address cal ...@@ -1709,7 +1709,7 @@ IRT_LEAF(void, SharedRuntime::fixup_callers_callsite(Method* method, address cal
// ask me how I know this... // ask me how I know this...
CodeBlob* cb = CodeCache::find_blob(caller_pc); CodeBlob* cb = CodeCache::find_blob(caller_pc);
if (!cb->is_nmethod() || entry_point == moop->get_c2i_entry()) { if (cb == NULL || !cb->is_nmethod() || entry_point == moop->get_c2i_entry()) {
return; return;
} }
...@@ -1760,7 +1760,7 @@ IRT_LEAF(void, SharedRuntime::fixup_callers_callsite(Method* method, address cal ...@@ -1760,7 +1760,7 @@ IRT_LEAF(void, SharedRuntime::fixup_callers_callsite(Method* method, address cal
if (destination != entry_point) { if (destination != entry_point) {
CodeBlob* callee = CodeCache::find_blob(destination); CodeBlob* callee = CodeCache::find_blob(destination);
// callee == cb seems weird. It means calling interpreter thru stub. // callee == cb seems weird. It means calling interpreter thru stub.
if (callee == cb || callee->is_adapter_blob()) { if (callee != NULL && (callee == cb || callee->is_adapter_blob())) {
// static call or optimized virtual // static call or optimized virtual
if (TraceCallFixup) { if (TraceCallFixup) {
tty->print("fixup callsite at " INTPTR_FORMAT " to compiled code for", caller_pc); tty->print("fixup callsite at " INTPTR_FORMAT " to compiled code for", caller_pc);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册