summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Andreas Gampe <agampe@google.com> 2015-06-19 22:58:47 -0700
committer Andreas Gampe <agampe@google.com> 2015-06-19 22:58:47 -0700
commit507cc6f83bf6379728f2dd20391f2ed5fbfe6371 (patch)
tree62aaeddc8dcf1fb652b92472d1327c31b4f84942
parent1e73a95d74848020fab512a95a7f9a7ada72497b (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.cc9
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