8026065: InterfaceMethodref for invokespecial must name a direct superinterface

Add verification to check that invokespecial of an InterfaceMethodref names a method in a direct superinterface of the current class or interface in accordance with JSR 335, JVMS 4.9.2 Structural Constraints.

Reviewed-by: acorn, hseigel, coleenp
This commit is contained in:
Lois Foltan 2013-11-26 09:52:22 -05:00 committed by Harold Seigel
parent b1e3461fe5
commit 28557bc30e
5 changed files with 71 additions and 3 deletions

View file

@ -1051,6 +1051,18 @@ bool InstanceKlass::implements_interface(Klass* k) const {
return false;
}
bool InstanceKlass::is_same_or_direct_interface(Klass *k) const {
// Verify direct super interface
if (this == k) return true;
assert(k->is_interface(), "should be an interface class");
for (int i = 0; i < local_interfaces()->length(); i++) {
if (local_interfaces()->at(i) == k) {
return true;
}
}
return false;
}
objArrayOop InstanceKlass::allocate_objArray(int n, int length, TRAPS) {
if (length < 0) THROW_0(vmSymbols::java_lang_NegativeArraySizeException());
if (length > arrayOopDesc::max_array_length(T_OBJECT)) {