From a6efe5e813457a1c7946a1e6c62646b7bd1150df Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Fri, 19 Jun 2015 22:58:47 -0700 Subject: ART: Disallow classes that are abstract and final Make the verifier fail such classes. Bug: 21873151 (cherry picked from commit 507cc6f83bf6379728f2dd20391f2ed5fbfe6371) Change-Id: I217f3d71f44bccdcee7ca830e092c807928bed39 --- runtime/verifier/method_verifier.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'runtime') 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 -- cgit v1.1