summaryrefslogtreecommitdiff
path: root/compiler/optimizing/instruction_builder.cc
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2020-12-23 16:37:44 +0000
committerNicolas Geoffray <ngeoffray@google.com>2021-01-06 16:31:10 +0000
commitbd570591eab2d683eb634ac057dbf9f0e1337f8c (patch)
treeb50ac19257a71cd9efb2ce596764b445a89cae87 /compiler/optimizing/instruction_builder.cc
parentbde70600e1bfa837fa48ea8da350f60b50272aa6 (diff)
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
Diffstat (limited to 'compiler/optimizing/instruction_builder.cc')
-rw-r--r--compiler/optimizing/instruction_builder.cc5
1 files changed, 5 insertions, 0 deletions
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<uint32_t>(
+ 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());
}