diff options
| author | 2015-06-19 22:58:47 -0700 | |
|---|---|---|
| committer | 2015-06-19 22:58:47 -0700 | |
| commit | 507cc6f83bf6379728f2dd20391f2ed5fbfe6371 (patch) | |
| tree | 62aaeddc8dcf1fb652b92472d1327c31b4f84942 | |
| parent | 1e73a95d74848020fab512a95a7f9a7ada72497b (diff) | |
ART: Disallow classes that are abstract and final
Make the verifier fail such classes.
Bug: 21873151
Change-Id: I217f3d71f44bccdcee7ca830e092c807928bed39
| -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 de51fe03d4..27a9ba09f9 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 |