OSDN Git Service

ART: Reject array-length on non-reference register
authorAndreas Gampe <agampe@google.com>
Mon, 28 Jul 2014 20:14:34 +0000 (13:14 -0700)
committerAndreas Gampe <agampe@google.com>
Mon, 28 Jul 2014 20:30:57 +0000 (13:30 -0700)
It should be a hard verifier failure if we detect an array-length
instruction over a non-reference-type register.

Bug: 16595896

(cherry picked from commit 65c9db8dfbeea3f708f95f058f4fed7c2af71052)

Change-Id: I56babcbe95d50fd66a132cf4434cf5fa780beb4e

runtime/verifier/method_verifier.cc

index afcc7c4..3214592 100644 (file)
@@ -1774,6 +1774,8 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) {
         } else {
           work_line_->SetRegisterType(inst->VRegA_12x(), reg_types_.Integer());
         }
+      } else {
+        Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "array-length on non-array " << res_type;
       }
       break;
     }