From bd570591eab2d683eb634ac057dbf9f0e1337f8c Mon Sep 17 00:00:00 2001 From: Nicolas Geoffray Date: Wed, 23 Dec 2020 16:37:44 +0000 Subject: Handle missing methods in compiler and nterp. Nterp already supported it, but there was a missing check in the compiler. Test: test.py Test: 552-invoke-non-existent-super Change-Id: Ife9f3f6782f09bd9780940bcb78160aa11db12d2 --- compiler/optimizing/instruction_builder.cc | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'compiler/optimizing/instruction_builder.cc') diff --git a/compiler/optimizing/instruction_builder.cc b/compiler/optimizing/instruction_builder.cc index cd03e054b5..76ee456b55 100644 --- a/compiler/optimizing/instruction_builder.cc +++ b/compiler/optimizing/instruction_builder.cc @@ -957,6 +957,11 @@ static ArtMethod* ResolveMethod(uint16_t method_idx, resolved_method, class_linker->GetImagePointerSize()); } else { uint16_t vtable_index = resolved_method->GetMethodIndex(); + if (vtable_index >= static_cast( + compiling_class->GetSuperClass()->GetVTableLength())) { + // No super method. The runtime will throw a NoSuchMethodError. + return nullptr; + } actual_method = compiling_class->GetSuperClass()->GetVTableEntry( vtable_index, class_linker->GetImagePointerSize()); } -- cgit v1.2.3-59-g8ed1b