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