From acc2bb693d83102f93007d7c4881a94bbcc3b9bb Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Thu, 17 Jul 2014 19:26:50 -0700 Subject: [PATCH] ART: Fail dex file verification on invalid access flags Only allow standard java access flags in class-def items. Bug: 16018234 Change-Id: I54e788817d5974faf7b3841cd01b9ca4568249c1 --- runtime/dex_file_verifier.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/runtime/dex_file_verifier.cc b/runtime/dex_file_verifier.cc index 291e2d075..00e05fc48 100644 --- a/runtime/dex_file_verifier.cc +++ b/runtime/dex_file_verifier.cc @@ -1650,6 +1650,12 @@ bool DexFileVerifier::CheckInterClassDefItem() { return false; } + // Only allow non-runtime modifiers. + if ((item->access_flags_ & ~kAccJavaFlagsMask) != 0) { + ErrorStringPrintf("Invalid class flags: '%d'", item->access_flags_); + return false; + } + if (item->interfaces_off_ != 0 && !CheckOffsetToTypeMap(item->interfaces_off_, DexFile::kDexTypeTypeList)) { return false; -- 2.11.0