OSDN Git Service

ART: Do not allow RETURN_VOID_NO_BARRIER outside constructors
authorAndreas Gampe <agampe@google.com>
Fri, 31 Jul 2015 18:34:24 +0000 (11:34 -0700)
committerAndreas Gampe <agampe@google.com>
Fri, 31 Jul 2015 18:34:24 +0000 (11:34 -0700)
Let the verifier fail non-constructor methods using the no-barrier
variant of return. This is a quickened return purely to avoid the
constructor barrier for final fields, and cannot be used as a stand-in
for a regular return.

Bug: https://code.google.com/p/android/issues/detail?id=181700
Bug: 22871329
Change-Id: I9559c6a1599c20ce526582527ebed73b25242767

runtime/verifier/method_verifier.cc

index d63b455..021102e 100644 (file)
@@ -2873,6 +2873,10 @@ bool MethodVerifier::CodeFlowVerifyInstruction(uint32_t* start_guess) {
             break;
           }
         }
+      } else {
+        Fail(VERIFY_ERROR_BAD_CLASS_HARD)
+            << "return-void-no-barrier not expected for non-constructor method "
+            << PrettyMethod(dex_method_idx_, *dex_file_, true);
       }
       break;
     // Note: the following instructions encode offsets derived from class linking.