Home | History | Annotate | Download | only in libdex

Lines Matching refs:item

339             ALOGE("Unknown map item type %04x", mapType);
346 * Helper for swapMap(), which indicates if an item type should appear
371 DexMapItem* item = pMap->list;
382 CHECK_LIST_SIZE(item, count, sizeOfItem);
385 SWAP_FIELD2(item->type);
386 SWAP_FIELD2(item->unused);
387 SWAP_FIELD4(item->size);
388 SWAP_OFFSET4(item->offset);
392 } else if (lastOffset >= item->offset) {
393 ALOGE("Out-of-order map item: %#x then %#x",
394 lastOffset, item->offset);
398 if (item->offset >= state->pHeader->fileSize) {
399 ALOGE("Map item after end of file: %x, size %#x",
400 item->offset, state->pHeader->fileSize);
404 if (isDataSectionType(item->type)) {
405 u4 icount = item->size;
422 u4 bit = mapTypeToBitMask(item->type);
429 ALOGE("Duplicate map section of type %#x", item->type);
434 lastOffset = item->offset;
435 item++;
520 /* Perform byte-swapping and intra-item verification on string_id_item. */
522 DexStringId* item = (DexStringId*) ptr;
524 CHECK_PTR_RANGE(item, item + 1);
525 SWAP_OFFSET4(item->stringDataOff);
527 return item + 1;
530 /* Perform cross-item verification of string_id_item. */
532 const DexStringId* item = (const DexStringId*) ptr;
535 item->stringDataOff, kDexTypeStringDataItem)) {
543 const char* s1 = dexGetStringData(state->pDexFile, item);
550 return (void*) (item + 1);
553 /* Perform byte-swapping and intra-item verification on type_id_item. */
555 DexTypeId* item = (DexTypeId*) ptr;
557 CHECK_PTR_RANGE(item, item + 1);
558 SWAP_INDEX4(item->descriptorIdx, state->pHeader->stringIdsSize);
560 return item + 1;
563 /* Perform cross-item verification of type_id_item. */
565 const DexTypeId* item = (const DexTypeId*) ptr;
567 dexStringById(state->pDexFile, item->descriptorIdx);
577 if (item0->descriptorIdx >= item->descriptorIdx) {
579 item0->descriptorIdx, item->descriptorIdx);
584 return (void*) (item + 1);
587 /* Perform byte-swapping and intra-item verification on proto_id_item. */
589 DexProtoId* item = (DexProtoId*) ptr;
591 CHECK_PTR_RANGE(item, item + 1);
592 SWAP_INDEX4(item->shortyIdx, state->pHeader->stringIdsSize);
593 SWAP_INDEX4(item->returnTypeIdx, state->pHeader->typeIdsSize);
594 SWAP_OFFSET4(item->parametersOff);
596 return item + 1;
644 /* Perform cross-item verification of proto_id_item. */
646 const DexProtoId* item = (const DexProtoId*) ptr;
648 dexStringById(state->pDexFile, item->shortyIdx);
651 item->parametersOff, kDexTypeTypeList)) {
656 dexStringByTypeIdx(state->pDexFile, item->returnTypeIdx),
661 u4 protoIdx = item - state->pDexFile->pProtoIds;
695 if (item0->returnTypeIdx > item->returnTypeIdx) {
698 } else if (item0->returnTypeIdx == item->returnTypeIdx) {
734 return (void*) (item + 1);
737 /* Perform byte-swapping and intra-item verification on field_id_item. */
739 DexFieldId* item = (DexFieldId*) ptr;
741 CHECK_PTR_RANGE(item, item + 1);
742 SWAP_INDEX2(item->classIdx, state->pHeader->typeIdsSize);
743 SWAP_INDEX2(item->typeIdx, state->pHeader->typeIdsSize);
744 SWAP_INDEX4(item->nameIdx, state->pHeader->stringIdsSize);
746 return item + 1;
749 /* Perform cross-item verification of field_id_item. */
751 const DexFieldId* item = (const DexFieldId*) ptr;
754 s = dexStringByTypeIdx(state->pDexFile, item->classIdx);
760 s = dexStringByTypeIdx(state->pDexFile, item->typeIdx);
766 s = dexStringById(state->pDexFile, item->nameIdx);
778 if (item0->classIdx > item->classIdx) {
781 } else if (item0->classIdx < item->classIdx) {
786 if (item0->nameIdx > item->nameIdx) {
789 } else if (item0->nameIdx < item->nameIdx) {
795 if (item0->typeIdx >= item->typeIdx) {
806 return (void*) (item + 1);
809 /* Perform byte-swapping and intra-item verification on method_id_item. */
811 DexMethodId* item = (DexMethodId*) ptr;
813 CHECK_PTR_RANGE(item, item + 1);
814 SWAP_INDEX2(item->classIdx, state->pHeader->typeIdsSize);
815 SWAP_INDEX2(item->protoIdx, state->pHeader->protoIdsSize);
816 SWAP_INDEX4(item->nameIdx, state->pHeader->stringIdsSize);
818 return item + 1;
821 /* Perform cross-item verification of method_id_item. */
823 const DexMethodId* item = (const DexMethodId*) ptr;
826 s = dexStringByTypeIdx(state->pDexFile, item->classIdx);
832 s = dexStringById(state->pDexFile, item->nameIdx);
844 if (item0->classIdx > item->classIdx) {
847 } else if (item0->classIdx < item->classIdx) {
852 if (item0->nameIdx > item->nameIdx) {
855 } else if (item0->nameIdx < item->nameIdx) {
861 if (item0->protoIdx >= item->protoIdx) {
872 return (void*) (item + 1);
875 /* Perform byte-swapping and intra-item verification on class_def_item. */
877 DexClassDef* item = (DexClassDef*) ptr;
879 CHECK_PTR_RANGE(item, item + 1);
880 SWAP_INDEX4(item->classIdx, state->pHeader->typeIdsSize);
881 SWAP_FIELD4(item->accessFlags);
882 SWAP_INDEX4_OR_NOINDEX(item->superclassIdx, state->pHeader->typeIdsSize);
883 SWAP_OFFSET4(item->interfacesOff);
884 SWAP_INDEX4_OR_NOINDEX(item->sourceFileIdx, state->pHeader->stringIdsSize);
885 SWAP_OFFSET4(item->annotationsOff);
886 SWAP_OFFSET4(item->classDataOff);
888 if ((item->accessFlags & ~ACC_CLASS_MASK) != 0) {
890 ALOGV("Bogus class access flags %x", item->accessFlags);
891 item->accessFlags &= ACC_CLASS_MASK;
894 return item + 1;
947 /* Perform cross-item verification of class_def_item. */
949 const DexClassDef* item = (const DexClassDef*) ptr;
950 u4 classIdx = item->classIdx;
965 item->interfacesOff, kDexTypeTypeList)
967 item->annotationsOff, kDexTypeAnnotationsDirectoryItem)
969 item->classDataOff, kDexTypeClassDataItem)
971 item->staticValuesOff, kDexTypeEncodedArrayItem);
977 if (item->superclassIdx != kDexNoIndex) {
978 descriptor = dexStringByTypeIdx(state->pDexFile, item->superclassIdx);
986 dexGetInterfacesList(state->pDexFile, item);
1025 if (!verifyClassDataIsForDef(state, item->classDataOff, item->classIdx)) {
1030 if (!verifyAnnotationsDirectoryIsForDef(state, item->annotationsOff,
1031 item->classIdx)) {
1036 return (void*) (item + 1);
1040 * byte-swapping and intra-item verification on an
1043 DexFieldAnnotationsItem* item = (DexFieldAnnotationsItem*) addr;
1048 CHECK_LIST_SIZE(item, count, sizeOfItem);
1051 SWAP_INDEX4(item->fieldIdx, state->pHeader->fieldIdsSize);
1052 SWAP_OFFSET4(item->annotationsOff);
1056 } else if (lastIdx >= item->fieldIdx) {
1058 item->fieldIdx);
1062 lastIdx = item->fieldIdx;
1063 item++;
1066 return (u1*) item;
1070 * byte-swapping and intra-item verification on an
1073 DexMethodAnnotationsItem* item = (DexMethodAnnotationsItem*) addr;
1078 CHECK_LIST_SIZE(item, count, sizeOfItem);
1081 SWAP_INDEX4(item->methodIdx, state->pHeader->methodIdsSize);
1082 SWAP_OFFSET4(item->annotationsOff);
1086 } else if (lastIdx >= item->methodIdx) {
1088 item->methodIdx);
1092 lastIdx = item->methodIdx;
1093 item++;
1096 return (u1*) item;
1100 * byte-swapping and intra-item verification on an
1104 DexParameterAnnotationsItem* item = (DexParameterAnnotationsItem*) addr;
1109 CHECK_LIST_SIZE(item, count, sizeOfItem);
1112 SWAP_INDEX4(item->methodIdx, state->pHeader->methodIdsSize);
1113 SWAP_OFFSET4(item->annotationsOff);
1117 } else if (lastIdx >= item->methodIdx) {
1119 item->methodIdx);
1123 lastIdx = item->methodIdx;
1124 item++;
1127 return (u1*) item;
1130 /* Perform byte-swapping and intra-item verification on
1133 DexAnnotationsDirectoryItem* item = (DexAnnotationsDirectoryItem*) ptr;
1135 CHECK_PTR_RANGE(item, item + 1);
1136 SWAP_OFFSET4(item->classAnnotationsOff);
1137 SWAP_FIELD4(item->fieldsSize);
1138 SWAP_FIELD4(item->methodsSize);
1139 SWAP_FIELD4(item->parametersSize);
1141 u1* addr = (u1*) (item + 1);
1143 if (item->fieldsSize != 0) {
1144 addr = swapFieldAnnotations(state, item->fieldsSize, addr);
1150 if (item->methodsSize != 0) {
1151 addr = swapMethodAnnotations(state, item->methodsSize, addr);
1157 if (item->parametersSize != 0) {
1158 addr = swapParameterAnnotations(state, item->parametersSize, addr);
1171 const DexFieldAnnotationsItem* item = (DexFieldAnnotationsItem*) addr;
1174 if (!verifyFieldDefiner(state, definingClass, item->fieldIdx)) {
1177 if (!dexDataMapVerify(state->pDataMap, item->annotationsOff,
1181 item++;
1184 return (const u1*) item;
1191 const DexMethodAnnotationsItem* item = (DexMethodAnnotationsItem*) addr;
1194 if (!verifyMethodDefiner(state, definingClass, item->methodIdx)) {
1197 if (!dexDataMapVerify(state->pDataMap, item->annotationsOff,
1201 item++;
1204 return (const u1*) item;
1211 const DexParameterAnnotationsItem* item =
1215 if (!verifyMethodDefiner(state, definingClass, item->methodIdx)) {
1218 if (!dexDataMapVerify(state->pDataMap, item->annotationsOff,
1222 item++;
1225 return (const u1*) item;
1230 * the definer of the first item in the data. */
1260 /* Perform cross-item verification of annotations_directory_item. */
1263 const DexAnnotationsDirectoryItem* item = (const DexAnnotationsDirectoryItem*) ptr;
1264 u4 definingClass = findFirstAnnotationsDirectoryDefiner(state, item);
1267 item->classAnnotationsOff, kDexTypeAnnotationSetItem)) {
1271 const u1* addr = (const u1*) (item + 1);
1273 if (item->fieldsSize != 0) {
1274 addr = crossVerifyFieldAnnotations(state, item->fieldsSize, addr,
1281 if (item->methodsSize != 0) {
1282 addr = crossVerifyMethodAnnotations(state, item->methodsSize, addr,
1289 if (item->parametersSize != 0) {
1290 addr = crossVerifyParameterAnnotations(state, item->parametersSize,
1300 /* Perform byte-swapping and intra-item verification on type_list. */
1323 /* Perform byte-swapping and intra-item verification on
1327 DexAnnotationSetRefItem* item;
1333 item = list->list;
1336 CHECK_LIST_SIZE(item, count, sizeOfItem);
1339 SWAP_OFFSET4(item->annotationsOff);
1340 item++;
1343 return item;
1346 /* Perform cross-item verification of annotation_set_ref_list. */
1350 const DexAnnotationSetRefItem* item = list->list;
1355 item->annotationsOff, kDexTypeAnnotationSetItem)) {
1358 item++;
1361 return (void*) item;
1364 /* Perform byte-swapping and intra-item verification on
1368 u4* item;
1374 item = set->entries;
1377 CHECK_LIST_SIZE(item, count, sizeOfItem);
1380 SWAP_OFFSET4(*item);
1381 item++;
1384 return item;
1389 static u4 annotationItemTypeIdx(const DexAnnotationItem* item) {
1390 const u1* data = item->annotation;
1394 /* Perform cross-item verification of annotation_set_item. */
1542 /* Perform intra-item verification on class_data_item. */
1565 * of the first item in the data. */
1595 /* Perform cross-item verification of class_data_item. */
1796 /* Perform byte-swapping and intra-item verification on code_item. */
1798 DexCode* item = (DexCode*) ptr;
1802 CHECK_PTR_RANGE(item, item + 1);
1803 SWAP_FIELD2(item->registersSize);
1804 SWAP_FIELD2(item->insSize);
1805 SWAP_FIELD2(item->outsSize);
1806 SWAP_FIELD2(item->triesSize);
1807 SWAP_OFFSET4(item->debugInfoOff);
1808 SWAP_FIELD4(item->insnsSize);
1810 if (item->insSize > item->registersSize) {
1811 ALOGE("insSize (%u) > registersSize (%u)", item->insSize,
1812 item->registersSize);
1816 if ((item->outsSize > 5) && (item->outsSize > item->registersSize)) {
1824 ALOGE("outsSize (%u) > registersSize (%u)", item->outsSize,
1825 item->registersSize);
1829 count = item->insnsSize;
1830 insns = item->insns;
1840 if (item->triesSize == 0) {
1851 ptr = swapTriesAndCatches(state, item);
1857 /* Perform intra-item verification on string_data_item. */
1958 /* Perform intra-item verification on debug_info_item. */
2336 /* Perform intra-item verification on encoded_array_item. */
2341 /* Perform intra-item verification on annotation_item. */
2362 /* Perform cross-item verification on annotation_item. */
2376 * Function to visit an individual top-level item type.
2416 ALOGE("Trouble with item %d @ offset %#x", i, offset);
2421 ALOGE("Item %d @ offset %#x ends out of bounds", i, offset);
2505 * does all possible intra-item verification, that is, verification
2507 * items. The intra-item limitation is because at the time an item is
2513 const DexMapItem* item = pMap->list;
2519 u4 sectionOffset = item->offset;
2520 u4 sectionCount = item->size;
2521 u2 type = item->type;
2665 ALOGE("Unknown map item type %04x", type);
2674 item++;
2681 * Perform cross-item verification on everything that needs it. This
2687 const DexMapItem* item = pMap->list;
2692 u4 sectionOffset = item->offset;
2693 u4 sectionCount = item->size;
2695 switch (item->type) {
2704 // There is no need for cross-item verification for these.
2766 ALOGE("Unknown map item type %04x", item->type);
2772 ALOGE("Cross-item verify of section type %04x failed",
2773 item->type);
2776 item++;