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>
Tue, 26 Aug 2014 17:34:40 +0000 (10:34 -0700)
The verifier will now reject any iget/iput insts
that do not have a reference object in vB.

Bug: 17207857
Signed-off-by: Stuart Monteith <stuart.monteith@arm.com>
(cherry picked from commit 695c5982eeddee18c643cc2f94c9d78fa75599ab)

Change-Id: I3790b8687673643bb142549d74f36a3e2978bf13

runtime/verifier/method_verifier.cc

index fb57fc7..c375c77 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 =