提交 f0071a34 编写于 作者: M morris

8008750: [partfait] Null pointer deference in hotspot/src/share/vm/oops/instanceKlass.hpp

Summary: fix null pointer
Reviewed-by: kvn, coleenp
上级 d78dd3b2
......@@ -2170,7 +2170,11 @@ void InstanceKlass::clean_implementors_list(BoolObjectClosure* is_alive) {
if (impl != NULL) {
if (!impl->is_loader_alive(is_alive)) {
// remove this guy
*adr_implementor() = NULL;
Klass** klass = adr_implementor();
assert(klass != NULL, "null klass");
if (klass != NULL) {
*klass = NULL;
}
}
}
}
......@@ -3151,9 +3155,10 @@ void InstanceKlass::verify_on(outputStream* st) {
if (protection_domain() != NULL) {
guarantee(protection_domain()->is_oop(), "should be oop");
}
if (host_klass() != NULL) {
guarantee(host_klass()->is_metadata(), "should be in metaspace");
guarantee(host_klass()->is_klass(), "should be klass");
const Klass* host = host_klass();
if (host != NULL) {
guarantee(host->is_metadata(), "should be in metaspace");
guarantee(host->is_klass(), "should be klass");
}
if (signers() != NULL) {
guarantee(signers()->is_objArray(), "should be obj array");
......
......@@ -536,7 +536,9 @@ class InstanceKlass: public Klass {
assert(is_anonymous(), "not anonymous");
Klass** addr = (Klass**)adr_host_klass();
assert(addr != NULL, "no reversed space");
*addr = host;
if (addr != NULL) {
*addr = host;
}
}
bool is_anonymous() const {
return (_misc_flags & _misc_is_anonymous) != 0;
......@@ -758,7 +760,10 @@ class InstanceKlass: public Klass {
void set_implementor(Klass* k) {
assert(is_interface(), "not interface");
Klass** addr = adr_implementor();
*addr = k;
assert(addr != NULL, "null addr");
if (addr != NULL) {
*addr = k;
}
}
int nof_implementors() const {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册