diff options
author | Andreas Gampe <agampe@google.com> | 2015-06-19 22:58:47 -0700 |
---|---|---|
committer | Andreas Gampe <agampe@google.com> | 2015-06-22 07:56:17 -0700 |
commit | a6efe5e813457a1c7946a1e6c62646b7bd1150df (patch) | |
tree | 94b28b49e249bbfde055a859df8cbce847481f55 /runtime | |
parent | 88593111c3a0fec728c1ced01740a20f702b3ffd (diff) | |
download | art-a6efe5e813457a1c7946a1e6c62646b7bd1150df.zip art-a6efe5e813457a1c7946a1e6c62646b7bd1150df.tar.gz art-a6efe5e813457a1c7946a1e6c62646b7bd1150df.tar.bz2 |
ART: Disallow classes that are abstract and final
Make the verifier fail such classes.
Bug: 21873151
(cherry picked from commit 507cc6f83bf6379728f2dd20391f2ed5fbfe6371)
Change-Id: I217f3d71f44bccdcee7ca830e092c807928bed39
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/verifier/method_verifier.cc | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/runtime/verifier/method_verifier.cc b/runtime/verifier/method_verifier.cc index bd78006..fe14d13 100644 --- a/runtime/verifier/method_verifier.cc +++ b/runtime/verifier/method_verifier.cc @@ -172,6 +172,15 @@ MethodVerifier::FailureKind MethodVerifier::VerifyClass(Thread* self, bool allow_soft_failures, std::string* error) { DCHECK(class_def != nullptr); + + // A class must not be abstract and final. + if ((class_def->access_flags_ & (kAccAbstract | kAccFinal)) == (kAccAbstract | kAccFinal)) { + *error = "Verifier rejected class "; + *error += PrettyDescriptor(dex_file->GetClassDescriptor(*class_def)); + *error += ": class is abstract and final."; + return kHardFailure; + } + const uint8_t* class_data = dex_file->GetClassData(*class_def); if (class_data == nullptr) { // empty class, probably a marker interface |