OSDN Git Service

ART: Reject field accesses to non-reference vregs.
authorStephen Kyle <stephen.kyle@arm.com>
Fri, 22 Aug 2014 14:03:07 +0000 (15:03 +0100)
committerAndreas Gampe <agampe@google.com>
Fri, 22 Aug 2014 20:33:35 +0000 (20:33 +0000)
The verifier will now reject any iget/iput insts
that do not have a reference object in vB.

Bug: 17207857
Change-Id: I2826f0f7abfc88561f4da9486588592f4b296d14
Signed-off-by: Stuart Monteith <stuart.monteith@arm.com>
runtime/verifier/method_verifier.cc

index 69627f5..ce2ec54 100644 (file)
@@ -3644,6 +3644,11 @@ mirror::ArtField* MethodVerifier::GetInstanceField(RegType& obj_type, int field_
   } else if (obj_type.IsZero()) {
     // Cannot infer and check type, however, access will cause null pointer exception
     return field;
+  } else if (!obj_type.IsReferenceTypes()) {
+    // Trying to read a field from something that isn't a reference
+    Fail(VERIFY_ERROR_BAD_CLASS_HARD) << "instance field access on object that has "
+                                      << "non-reference type " << obj_type;
+    return NULL;
   } else {
     mirror::Class* klass = field->GetDeclaringClass();
     RegType& field_klass =