MCPcopy Create free account
hub / github.com/CodingGay/BlackDex / CheckInterSection

Method CheckInterSection

Bcore/src/main/cpp/dex/dex_file_verifier.cc:2804–2856  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2802}
2803
2804bool DexFileVerifier::CheckInterSection() {
2805 const DexFile::MapList* map = reinterpret_cast<const DexFile::MapList*>(begin_ + header_->map_off_);
2806 const DexFile::MapItem* item = map->list_;
2807 uint32_t count = map->size_;
2808
2809 // Cross check the items listed in the map.
2810 while (count--) {
2811 uint32_t section_offset = item->offset_;
2812 uint32_t section_count = item->size_;
2813 DexFile::MapItemType type = static_cast<DexFile::MapItemType>(item->type_);
2814 bool found = false;
2815
2816 switch (type) {
2817 case DexFile::kDexTypeHeaderItem:
2818 case DexFile::kDexTypeMapList:
2819 case DexFile::kDexTypeTypeList:
2820 case DexFile::kDexTypeCodeItem:
2821 case DexFile::kDexTypeStringDataItem:
2822 case DexFile::kDexTypeDebugInfoItem:
2823 case DexFile::kDexTypeAnnotationItem:
2824 case DexFile::kDexTypeEncodedArrayItem:
2825 found = true;
2826 break;
2827 case DexFile::kDexTypeStringIdItem:
2828 case DexFile::kDexTypeTypeIdItem:
2829 case DexFile::kDexTypeProtoIdItem:
2830 case DexFile::kDexTypeFieldIdItem:
2831 case DexFile::kDexTypeMethodIdItem:
2832 case DexFile::kDexTypeClassDefItem:
2833 case DexFile::kDexTypeCallSiteIdItem:
2834 case DexFile::kDexTypeMethodHandleItem:
2835 case DexFile::kDexTypeAnnotationSetRefList:
2836 case DexFile::kDexTypeAnnotationSetItem:
2837 case DexFile::kDexTypeClassDataItem:
2838 case DexFile::kDexTypeAnnotationsDirectoryItem: {
2839 if (!CheckInterSectionIterate(section_offset, section_count, type)) {
2840 return false;
2841 }
2842 found = true;
2843 break;
2844 }
2845 }
2846
2847 if (!found) {
2848 ErrorStringPrintf("Unknown map item type %x", item->type_);
2849 return false;
2850 }
2851
2852 item++;
2853 }
2854
2855 return true;
2856}
2857
2858bool DexFileVerifier::Verify() {
2859 // Check the header.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected