diff options
| author | 2015-12-11 19:01:41 +0000 | |
|---|---|---|
| committer | 2015-12-11 19:01:41 +0000 | |
| commit | 277da370dd517af0d6a27bef3b86d5f259feda62 (patch) | |
| tree | dba76caacac993db6b93b0ec9714f708372c6274 | |
| parent | 66e43b115ed53512803403d25f88bb4a37590676 (diff) | |
| parent | 97b113596576ee026c9d3e100e472e343bfda7fa (diff) | |
Merge "ART: Weaken dex file verifier abstract check"
| -rw-r--r-- | runtime/dex_file_verifier.cc | 9 | ||||
| -rw-r--r-- | test/800-smali/expected.txt | 1 | ||||
| -rw-r--r-- | test/800-smali/smali/b_26143249.smali | 20 | ||||
| -rw-r--r-- | test/800-smali/src/Main.java | 2 |
4 files changed, 28 insertions, 4 deletions
diff --git a/runtime/dex_file_verifier.cc b/runtime/dex_file_verifier.cc index 440d696ea9..727f4fc659 100644 --- a/runtime/dex_file_verifier.cc +++ b/runtime/dex_file_verifier.cc @@ -2508,11 +2508,12 @@ bool DexFileVerifier::CheckMethodAccessFlags(uint32_t method_index, method_access_flags); return false; } - // Abstract methods must be in an abstract class or interface. + // Abstract methods should be in an abstract class or interface. if ((class_access_flags & (kAccInterface | kAccAbstract)) == 0) { - *error_msg = StringPrintf("Method %" PRIu32 " is abstract, but the declaring class " - "is neither abstract nor an interface", method_index); - return false; + LOG(WARNING) << "Method " << PrettyMethod(method_index, *dex_file_) + << " is abstract, but the declaring class is neither abstract nor an " + << "interface in dex file " + << dex_file_->GetLocation(); } } // Interfaces are special. diff --git a/test/800-smali/expected.txt b/test/800-smali/expected.txt index ebefeea405..27f5b5d552 100644 --- a/test/800-smali/expected.txt +++ b/test/800-smali/expected.txt @@ -48,4 +48,5 @@ b/23502994 (if-eqz) b/23502994 (check-cast) b/25494456 b/21869691 +b/26143249 Done! diff --git a/test/800-smali/smali/b_26143249.smali b/test/800-smali/smali/b_26143249.smali new file mode 100644 index 0000000000..aa69e84bfa --- /dev/null +++ b/test/800-smali/smali/b_26143249.smali @@ -0,0 +1,20 @@ +# Make sure we accept non-abstract classes with abstract members. + +.class public LB26143249; + +.super Ljava/lang/Object; + +.method public constructor <init>()V + .registers 1 + invoke-direct {p0}, Ljava/lang/Object;-><init>()V + return-void +.end method + +.method public run()V + .registers 1 + invoke-virtual {p0}, LB26143249;->abs()V + return-void +.end method + +.method public abstract abs()V +.end method diff --git a/test/800-smali/src/Main.java b/test/800-smali/src/Main.java index 3b62a46fd3..cc3b0b44f9 100644 --- a/test/800-smali/src/Main.java +++ b/test/800-smali/src/Main.java @@ -141,6 +141,8 @@ public class Main { null)); testCases.add(new TestCase("b/21869691", "B21869691A", "run", null, new IncompatibleClassChangeError(), null)); + testCases.add(new TestCase("b/26143249", "B26143249", "run", null, + new AbstractMethodError(), null)); } public void runTests() { |