6964170: Verifier crashes

Check if klassOop != NULL rather than klass_part != NULL

Reviewed-by: kamg, never
This commit is contained in:
Andrei Pangin 2010-07-20 08:41:42 -07:00
parent 8ce591cea8
commit 3888d500b9
2 changed files with 6 additions and 8 deletions

View file

@ -70,7 +70,9 @@ bool VerificationType::is_reference_assignable_from(
} else if (is_array() && from.is_array()) { } else if (is_array() && from.is_array()) {
VerificationType comp_this = get_component(CHECK_false); VerificationType comp_this = get_component(CHECK_false);
VerificationType comp_from = from.get_component(CHECK_false); VerificationType comp_from = from.get_component(CHECK_false);
return comp_this.is_assignable_from(comp_from, context, CHECK_false); if (!comp_this.is_bogus() && !comp_from.is_bogus()) {
return comp_this.is_assignable_from(comp_from, context, CHECK_false);
}
} }
return false; return false;
} }
@ -98,7 +100,7 @@ VerificationType VerificationType::get_component(TRAPS) const {
CHECK_(VerificationType::bogus_type())); CHECK_(VerificationType::bogus_type()));
return VerificationType::reference_type(component); return VerificationType::reference_type(component);
default: default:
ShouldNotReachHere(); // Met an invalid type signature, e.g. [X
return VerificationType::bogus_type(); return VerificationType::bogus_type();
} }
} }

View file

@ -1847,12 +1847,8 @@ void ClassVerifier::verify_invoke_init(
if (type == VerificationType::uninitialized_this_type()) { if (type == VerificationType::uninitialized_this_type()) {
// The method must be an <init> method of either this class, or one of its // The method must be an <init> method of either this class, or one of its
// superclasses // superclasses
klassOop oop = current_class()(); if (ref_class_type.name() != current_class()->name() &&
Klass* klass = oop->klass_part(); !name_in_supers(ref_class_type.name(), current_class())) {
while (klass != NULL && ref_class_type.name() != klass->name()) {
klass = klass->super()->klass_part();
}
if (klass == NULL) {
verify_error(bci, "Bad <init> method call"); verify_error(bci, "Bad <init> method call");
return; return;
} }