ART: Invoke_virtual needs at least receiver parameter
Makes the method verifier reject invoke_virtual instructions that
claim they do not need any parameters.
Bug: 15570946
Change-Id: Ia76fddb7a08551d6c08654950e7085f09eacf430
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc
index e5dcbb0..487ecde 100644
--- a/runtime/verifier/method_verifier.cc
+++ b/runtime/verifier/method_verifier.cc
@@ -2131,6 +2131,9 @@
case Instruction::INVOKE_VIRTUAL_RANGE:
case Instruction::INVOKE_SUPER:
case Instruction::INVOKE_SUPER_RANGE: {
+ if (inst->VRegA() == 0) {
+ Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "invoke_virtual/super needs at least receiver";
+ }
bool is_range = (inst->Opcode() == Instruction::INVOKE_VIRTUAL_RANGE ||
inst->Opcode() == Instruction::INVOKE_SUPER_RANGE);
bool is_super = (inst->Opcode() == Instruction::INVOKE_SUPER ||