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

Method CheckIntraIdSection

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

Source from the content-addressed store, hash-verified

1790}
1791
1792bool DexFileVerifier::CheckIntraIdSection(size_t offset,
1793 uint32_t count,
1794 DexFile::MapItemType type) {
1795 uint32_t expected_offset;
1796 uint32_t expected_size;
1797
1798 // Get the expected offset and size from the header.
1799 switch (type) {
1800 case DexFile::kDexTypeStringIdItem:
1801 expected_offset = header_->string_ids_off_;
1802 expected_size = header_->string_ids_size_;
1803 break;
1804 case DexFile::kDexTypeTypeIdItem:
1805 expected_offset = header_->type_ids_off_;
1806 expected_size = header_->type_ids_size_;
1807 break;
1808 case DexFile::kDexTypeProtoIdItem:
1809 expected_offset = header_->proto_ids_off_;
1810 expected_size = header_->proto_ids_size_;
1811 break;
1812 case DexFile::kDexTypeFieldIdItem:
1813 expected_offset = header_->field_ids_off_;
1814 expected_size = header_->field_ids_size_;
1815 break;
1816 case DexFile::kDexTypeMethodIdItem:
1817 expected_offset = header_->method_ids_off_;
1818 expected_size = header_->method_ids_size_;
1819 break;
1820 case DexFile::kDexTypeClassDefItem:
1821 expected_offset = header_->class_defs_off_;
1822 expected_size = header_->class_defs_size_;
1823 break;
1824 default:
1825 ErrorStringPrintf("Bad type for id section: %x", type);
1826 return false;
1827 }
1828
1829 // Check that the offset and size are what were expected from the header.
1830 if (UNLIKELY(offset != expected_offset)) {
1831 ErrorStringPrintf("Bad offset for section: got %zx, expected %x", offset, expected_offset);
1832 return false;
1833 }
1834 if (UNLIKELY(count != expected_size)) {
1835 ErrorStringPrintf("Bad size for section: got %x, expected %x", count, expected_size);
1836 return false;
1837 }
1838
1839 return CheckIntraSectionIterate(offset, count, type);
1840}
1841
1842bool DexFileVerifier::CheckIntraDataSection(size_t offset,
1843 uint32_t count,

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected