提交 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 {
ResourceMark rm;
assert(is_constMethod(), "must be constMethod");
st->print_cr("%s", internal_name());
st->print(" - method: " INTPTR_FORMAT " ", p2i((address)method()));
method()->print_value_on(st); st->cr();
Method* m = method();
st->print(" - method: " INTPTR_FORMAT " ", p2i((address)m));
if (m != NULL) {
m->print_value_on(st);
}
st->cr();
if (has_stackmap_table()) {
st->print(" - stackmap data: ");
stackmap_data()->print_value_on(st);
......@@ -404,7 +408,12 @@ void ConstMethod::print_on(outputStream* st) const {
void ConstMethod::print_value_on(outputStream* st) const {
assert(is_constMethod(), "must be constMethod");
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
......@@ -444,7 +453,7 @@ void ConstMethod::verify_on(outputStream* st) {
// Verification can occur during oop construction before the method or
// 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 compressed_table_start = code_end();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册