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

Method CheckInterSectionIterate

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

Source from the content-addressed store, hash-verified

2668}
2669
2670bool DexFileVerifier::CheckInterSectionIterate(size_t offset,
2671 uint32_t count,
2672 DexFile::MapItemType type) {
2673 // Get the right alignment mask for the type of section.
2674 size_t alignment_mask;
2675 switch (type) {
2676 case DexFile::kDexTypeClassDataItem:
2677 alignment_mask = sizeof(uint8_t) - 1;
2678 break;
2679 default:
2680 alignment_mask = sizeof(uint32_t) - 1;
2681 break;
2682 }
2683
2684 // Iterate through the items in the section.
2685 previous_item_ = nullptr;
2686 for (uint32_t i = 0; i < count; i++) {
2687 uint32_t new_offset = (offset + alignment_mask) & ~alignment_mask;
2688 ptr_ = begin_ + new_offset;
2689 const uint8_t* prev_ptr = ptr_;
2690
2691 if (MapTypeToBitMask(type) == 0) {
2692 ErrorStringPrintf("Unknown map item type %x", type);
2693 return false;
2694 }
2695
2696 // Check depending on the section type.
2697 switch (type) {
2698 case DexFile::kDexTypeHeaderItem:
2699 case DexFile::kDexTypeMapList:
2700 case DexFile::kDexTypeTypeList:
2701 case DexFile::kDexTypeCodeItem:
2702 case DexFile::kDexTypeStringDataItem:
2703 case DexFile::kDexTypeDebugInfoItem:
2704 case DexFile::kDexTypeAnnotationItem:
2705 case DexFile::kDexTypeEncodedArrayItem:
2706 break;
2707 case DexFile::kDexTypeStringIdItem: {
2708 if (!CheckInterStringIdItem()) {
2709 return false;
2710 }
2711 break;
2712 }
2713 case DexFile::kDexTypeTypeIdItem: {
2714 if (!CheckInterTypeIdItem()) {
2715 return false;
2716 }
2717 break;
2718 }
2719 case DexFile::kDexTypeProtoIdItem: {
2720 if (!CheckInterProtoIdItem()) {
2721 return false;
2722 }
2723 break;
2724 }
2725 case DexFile::kDexTypeFieldIdItem: {
2726 if (!CheckInterFieldIdItem()) {
2727 return false;

Callers

nothing calls this directly

Calls 1

MapTypeToBitMaskFunction · 0.85

Tested by

no test coverage detected