Lines Matching full:item
364 LOGE("Unknown map item type %04x\n", mapType);
371 * Helper for swapMap(), which indicates if an item type should appear
396 DexMapItem* item = pMap->list;
407 CHECK_LIST_SIZE(item, count, sizeof(DexMapItem));
410 SWAP_FIELD2(item->type);
411 SWAP_FIELD2(item->unused);
412 SWAP_FIELD4(item->size);
413 SWAP_OFFSET4(item->offset);
417 } else if (lastOffset >= item->offset) {
418 LOGE("Out-of-order map item: 0x%x then 0x%x\n",
419 lastOffset, item->offset);
423 if (item->offset >= state->pHeader->fileSize) {
424 LOGE("Map item after end of file: %x, size 0x%x\n",
425 item->offset, state->pHeader->fileSize);
429 if (isDataSectionType(item->type)) {
430 u4 icount = item->size;
447 u4 bit = mapTypeToBitMask(item->type);
454 LOGE("Duplicate map section of type 0x%x\n", item->type);
459 lastOffset = item->offset;
460 item++;
545 /* Perform byte-swapping and intra-item verification on string_id_item. */
547 DexStringId* item = ptr;
549 CHECK_PTR_RANGE(item, item + 1);
550 SWAP_OFFSET4(item->stringDataOff);
552 return item + 1;
555 /* Perform cross-item verification of string_id_item. */
557 const DexStringId* item = ptr;
560 item->stringDataOff, kDexTypeStringDataItem)) {
568 const char* s1 = dexGetStringData(state->pDexFile, item);
575 return (void*) (item + 1);
578 /* Perform byte-swapping and intra-item verification on type_id_item. */
580 DexTypeId* item = ptr;
582 CHECK_PTR_RANGE(item, item + 1);
583 SWAP_INDEX4(item->descriptorIdx, state->pHeader->stringIdsSize);
585 return item + 1;
588 /* Perform cross-item verification of type_id_item. */
590 const DexTypeId* item = ptr;
592 dexStringById(state->pDexFile, item->descriptorIdx);
602 if (item0->descriptorIdx >= item->descriptorIdx) {
604 item0->descriptorIdx, item->descriptorIdx);
609 return (void*) (item + 1);
612 /* Perform byte-swapping and intra-item verification on proto_id_item. */
614 DexProtoId* item = ptr;
616 CHECK_PTR_RANGE(item, item + 1);
617 SWAP_INDEX4(item->shortyIdx, state->pHeader->stringIdsSize);
618 SWAP_INDEX4(item->returnTypeIdx, state->pHeader->typeIdsSize);
619 SWAP_OFFSET4(item->parametersOff);
621 return item + 1;
669 /* Perform cross-item verification of proto_id_item. */
671 const DexProtoId* item = ptr;
673 dexStringById(state->pDexFile, item->shortyIdx);
676 item->parametersOff, kDexTypeTypeList)) {
681 dexStringByTypeIdx(state->pDexFile, item->returnTypeIdx),
686 u4 protoIdx = item - state->pDexFile->pProtoIds;
720 if (item0->returnTypeIdx > item->returnTypeIdx) {
723 } else if (item0->returnTypeIdx == item->returnTypeIdx) {
759 return (void*) (item + 1);
762 /* Perform byte-swapping and intra-item verification on field_id_item. */
764 DexFieldId* item = ptr;
766 CHECK_PTR_RANGE(item, item + 1);
767 SWAP_INDEX2(item->classIdx, state->pHeader->typeIdsSize);
768 SWAP_INDEX2(item->typeIdx, state->pHeader->typeIdsSize);
769 SWAP_INDEX4(item->nameIdx, state->pHeader->stringIdsSize);
771 return item + 1;
774 /* Perform cross-item verification of field_id_item. */
776 const DexFieldId* item = ptr;
779 s = dexStringByTypeIdx(state->pDexFile, item->classIdx);
785 s = dexStringByTypeIdx(state->pDexFile, item->typeIdx);
791 s = dexStringById(state->pDexFile, item->nameIdx);
803 if (item0->classIdx > item->classIdx) {
806 } else if (item0->classIdx < item->classIdx) {
811 if (item0->nameIdx > item->nameIdx) {
814 } else if (item0->nameIdx < item->nameIdx) {
820 if (item0->typeIdx >= item->typeIdx) {
831 return (void*) (item + 1);
834 /* Perform byte-swapping and intra-item verification on method_id_item. */
836 DexMethodId* item = ptr;
838 CHECK_PTR_RANGE(item, item + 1);
839 SWAP_INDEX2(item->classIdx, state->pHeader->typeIdsSize);
840 SWAP_INDEX2(item->protoIdx, state->pHeader->protoIdsSize);
841 SWAP_INDEX4(item->nameIdx, state->pHeader->stringIdsSize);
843 return item + 1;
846 /* Perform cross-item verification of method_id_item. */
848 const DexMethodId* item = ptr;
851 s = dexStringByTypeIdx(state->pDexFile, item->classIdx);
857 s = dexStringById(state->pDexFile, item->nameIdx);
869 if (item0->classIdx > item->classIdx) {
872 } else if (item0->classIdx < item->classIdx) {
877 if (item0->nameIdx > item->nameIdx) {
880 } else if (item0->nameIdx < item->nameIdx) {
886 if (item0->protoIdx >= item->protoIdx) {
897 return (void*) (item + 1);
900 /* Perform byte-swapping and intra-item verification on class_def_item. */
902 DexClassDef* item = ptr;
904 CHECK_PTR_RANGE(item, item + 1);
905 SWAP_INDEX4(item->classIdx, state->pHeader->typeIdsSize);
906 SWAP_FIELD4(item->accessFlags);
907 SWAP_INDEX4_OR_NOINDEX(item->superclassIdx, state->pHeader->typeIdsSize);
908 SWAP_OFFSET4(item->interfacesOff);
909 SWAP_INDEX4_OR_NOINDEX(item->sourceFileIdx, state->pHeader->stringIdsSize);
910 SWAP_OFFSET4(item->annotationsOff);
911 SWAP_OFFSET4(item->classDataOff);
913 return item + 1;
965 /* Perform cross-item verification of class_def_item. */
967 const DexClassDef* item = ptr;
968 u4 classIdx = item->classIdx;
983 item->interfacesOff, kDexTypeTypeList)
985 item->annotationsOff, kDexTypeAnnotationsDirectoryItem)
987 item->classDataOff, kDexTypeClassDataItem)
989 item->staticValuesOff, kDexTypeEncodedArrayItem);
995 if (item->superclassIdx != kDexNoIndex) {
996 descriptor = dexStringByTypeIdx(state->pDexFile, item->superclassIdx);
1004 dexGetInterfacesList(state->pDexFile, item);
1043 if (!verifyClassDataIsForDef(state, item->classDataOff, item->classIdx)) {
1048 if (!verifyAnnotationsDirectoryIsForDef(state, item->annotationsOff,
1049 item->classIdx)) {
1054 return (void*) (item + 1);
1058 * byte-swapping and intra-item verification on an
1061 DexFieldAnnotationsItem* item = (DexFieldAnnotationsItem*) addr;
1065 CHECK_LIST_SIZE(item, count, sizeof(DexFieldAnnotationsItem));
1068 SWAP_INDEX4(item->fieldIdx, state->pHeader->fieldIdsSize);
1069 SWAP_OFFSET4(item->annotationsOff);
1073 } else if (lastIdx >= item->fieldIdx) {
1075 item->fieldIdx);
1079 lastIdx = item->fieldIdx;
1080 item++;
1083 return (u1*) item;
1087 * byte-swapping and intra-item verification on an
1090 DexMethodAnnotationsItem* item = (DexMethodAnnotationsItem*) addr;
1094 CHECK_LIST_SIZE(item, count, sizeof(DexMethodAnnotationsItem));
1097 SWAP_INDEX4(item->methodIdx, state->pHeader->methodIdsSize);
1098 SWAP_OFFSET4(item->annotationsOff);
1102 } else if (lastIdx >= item->methodIdx) {
1104 item->methodIdx);
1108 lastIdx = item->methodIdx;
1109 item++;
1112 return (u1*) item;
1116 * byte-swapping and intra-item verification on an
1120 DexParameterAnnotationsItem* item = (DexParameterAnnotationsItem*) addr;
1124 CHECK_LIST_SIZE(item, count, sizeof(DexParameterAnnotationsItem));
1127 SWAP_INDEX4(item->methodIdx, state->pHeader->methodIdsSize);
1128 SWAP_OFFSET4(item->annotationsOff);
1132 } else if (lastIdx >= item->methodIdx) {
1134 item->methodIdx);
1138 lastIdx = item->methodIdx;
1139 item++;
1142 return (u1*) item;
1145 /* Perform byte-swapping and intra-item verification on
1148 DexAnnotationsDirectoryItem* item = ptr;
1150 CHECK_PTR_RANGE(item, item + 1);
1151 SWAP_OFFSET4(item->classAnnotationsOff);
1152 SWAP_FIELD4(item->fieldsSize);
1153 SWAP_FIELD4(item->methodsSize);
1154 SWAP_FIELD4(item->parametersSize);
1156 u1* addr = (u1*) (item + 1);
1158 if (item->fieldsSize != 0) {
1159 addr = swapFieldAnnotations(state, item->fieldsSize, addr);
1165 if (item->methodsSize != 0) {
1166 addr = swapMethodAnnotations(state, item->methodsSize, addr);
1172 if (item->parametersSize != 0) {
1173 addr = swapParameterAnnotations(state, item->parametersSize, addr);
1186 const DexFieldAnnotationsItem* item = (DexFieldAnnotationsItem*) addr;
1189 if (!verifyFieldDefiner(state, definingClass, item->fieldIdx)) {
1192 if (!dexDataMapVerify(state->pDataMap, item->annotationsOff,
1196 item++;
1199 return (const u1*) item;
1206 const DexMethodAnnotationsItem* item = (DexMethodAnnotationsItem*) addr;
1209 if (!verifyMethodDefiner(state, definingClass, item->methodIdx)) {
1212 if (!dexDataMapVerify(state->pDataMap, item->annotationsOff,
1216 item++;
1219 return (const u1*) item;
1226 const DexParameterAnnotationsItem* item =
1230 if (!verifyMethodDefiner(state, definingClass, item->methodIdx)) {
1233 if (!dexDataMapVerify(state->pDataMap, item->annotationsOff,
1237 item++;
1240 return (const u1*) item;
1245 * the definer of the first item in the data. */
1275 /* Perform cross-item verification of annotations_directory_item. */
1278 const DexAnnotationsDirectoryItem* item = ptr;
1279 u4 definingClass = findFirstAnnotationsDirectoryDefiner(state, item);
1282 item->classAnnotationsOff, kDexTypeAnnotationSetItem)) {
1286 const u1* addr = (const u1*) (item + 1);
1288 if (item->fieldsSize != 0) {
1289 addr = crossVerifyFieldAnnotations(state, item->fieldsSize, addr,
1296 if (item->methodsSize != 0) {
1297 addr = crossVerifyMethodAnnotations(state, item->methodsSize, addr,
1304 if (item->parametersSize != 0) {
1305 addr = crossVerifyParameterAnnotations(state, item->parametersSize,
1315 /* Perform byte-swapping and intra-item verification on type_list. */
1336 /* Perform byte-swapping and intra-item verification on
1340 DexAnnotationSetRefItem* item;
1346 item = list->list;
1347 CHECK_LIST_SIZE(item, count, sizeof(DexAnnotationSetRefItem));
1350 SWAP_OFFSET4(item->annotationsOff);
1351 item++;
1354 return item;
1357 /* Perform cross-item verification of annotation_set_ref_list. */
1361 const DexAnnotationSetRefItem* item = list->list;
1366 item->annotationsOff, kDexTypeAnnotationSetItem)) {
1369 item++;
1372 return (void*) item;
1375 /* Perform byte-swapping and intra-item verification on
1379 u4* item;
1385 item = set->entries;
1386 CHECK_LIST_SIZE(item, count, sizeof(u4));
1389 SWAP_OFFSET4(*item);
1390 item++;
1393 return item;
1398 static u4 annotationItemTypeIdx(const DexAnnotationItem* item) {
1399 const u1* data = item->annotation;
1403 /* Perform cross-item verification of annotation_set_item. */
1545 /* Perform intra-item verification on class_data_item. */
1568 * of the first item in the data. */
1598 /* Perform cross-item verification of class_data_item. */
1798 /* Perform byte-swapping and intra-item verification on code_item. */
1800 DexCode* item = ptr;
1804 CHECK_PTR_RANGE(item, item + 1);
1805 SWAP_FIELD2(item->registersSize);
1806 SWAP_FIELD2(item->insSize);
1807 SWAP_FIELD2(item->outsSize);
1808 SWAP_FIELD2(item->triesSize);
1809 SWAP_OFFSET4(item->debugInfoOff);
1810 SWAP_FIELD4(item->insnsSize);
1812 count = item->insnsSize;
1813 insns = item->insns;
1821 if (item->triesSize == 0) {
1832 ptr = swapTriesAndCatches(state, item);
1838 /* Perform intra-item verification on string_data_item. */
1939 /* Perform intra-item verification on debug_info_item. */
2317 /* Perform intra-item verification on encoded_array_item. */
2322 /* Perform intra-item verification on annotation_item. */
2343 /* Perform cross-item verification on annotation_item. */
2357 * Function to visit an individual top-level item type.
2397 LOGE("Trouble with item %d @ offset 0x%x\n", i, offset);
2402 LOGE("Item %d @ offset 0x%x ends out of bounds\n", i, offset);
2486 * does all possible intra-item verification, that is, verification
2488 * items. The intra-item limitation is because at the time an item is
2494 const DexMapItem* item = pMap->list;
2500 u4 sectionOffset = item->offset;
2501 u4 sectionCount = item->size;
2502 u2 type = item->type;
2646 LOGE("Unknown map item type %04x\n", type);
2655 item++;
2662 * Perform cross-item verification on everything that needs it. This
2668 const DexMapItem* item = pMap->list;
2673 u4 sectionOffset = item->offset;
2674 u4 sectionCount = item->size;
2676 switch (item->type) {
2685 // There is no need for cross-item verification for these.
2747 LOGE("Unknown map item type %04x\n", item->type);
2753 LOGE("Cross-item verify of section type %04x failed\n",
2754 item->type);
2757 item++;