提交 53ac650d 编写于 作者: T thartmann

8180565: Null pointer dereferences of ConstMethod::method()

Summary: We need to check ConstMethod::method() for NULL before dereferencing.
Reviewed-by: kvn, iignatyev
上级 150b7cf6
...@@ -390,8 +390,12 @@ void ConstMethod::print_on(outputStream* st) const { ...@@ -390,8 +390,12 @@ void ConstMethod::print_on(outputStream* st) const {
ResourceMark rm; ResourceMark rm;
assert(is_constMethod(), "must be constMethod"); assert(is_constMethod(), "must be constMethod");
st->print_cr("%s", internal_name()); st->print_cr("%s", internal_name());
st->print(" - method: " INTPTR_FORMAT " ", p2i((address)method())); Method* m = method();
method()->print_value_on(st); st->cr(); st->print(" - method: " INTPTR_FORMAT " ", p2i((address)m));
if (m != NULL) {
m->print_value_on(st);
}
st->cr();
if (has_stackmap_table()) { if (has_stackmap_table()) {
st->print(" - stackmap data: "); st->print(" - stackmap data: ");
stackmap_data()->print_value_on(st); stackmap_data()->print_value_on(st);
...@@ -404,7 +408,12 @@ void ConstMethod::print_on(outputStream* st) const { ...@@ -404,7 +408,12 @@ void ConstMethod::print_on(outputStream* st) const {
void ConstMethod::print_value_on(outputStream* st) const { void ConstMethod::print_value_on(outputStream* st) const {
assert(is_constMethod(), "must be constMethod"); assert(is_constMethod(), "must be constMethod");
st->print(" const part of method " ); st->print(" const part of method " );
method()->print_value_on(st); Method* m = method();
if (m != NULL) {
m->print_value_on(st);
} else {
st->print("NULL");
}
} }
#if INCLUDE_SERVICES #if INCLUDE_SERVICES
...@@ -444,7 +453,7 @@ void ConstMethod::verify_on(outputStream* st) { ...@@ -444,7 +453,7 @@ void ConstMethod::verify_on(outputStream* st) {
// Verification can occur during oop construction before the method or // Verification can occur during oop construction before the method or
// other fields have been initialized. // other fields have been initialized.
guarantee(method()->is_method(), "should be method"); guarantee(method() != NULL && method()->is_method(), "should be method");
address m_end = (address)((intptr_t) this + size()); address m_end = (address)((intptr_t) this + size());
address compressed_table_start = code_end(); address compressed_table_start = code_end();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册