Home | History | Annotate | Download | only in libdex

Lines Matching refs:item

365             ALOGE("Unknown map item type %04x", mapType);
372 * Helper for swapMap(), which indicates if an item type should appear
397 DexMapItem* item = pMap->list;
408 CHECK_LIST_SIZE(item, count, sizeof(DexMapItem));
411 SWAP_FIELD2(item->type);
412 SWAP_FIELD2(item->unused);
413 SWAP_FIELD4(item->size);
414 SWAP_OFFSET4(item->offset);
418 } else if (lastOffset >= item->offset) {
419 ALOGE("Out-of-order map item: %#x then %#x",
420 lastOffset, item->offset);
424 if (item->offset >= state->pHeader->fileSize) {
425 ALOGE("Map item after end of file: %x, size %#x",
426 item->offset, state->pHeader->fileSize);
430 if (isDataSectionType(item->type)) {
431 u4 icount = item->size;
448 u4 bit = mapTypeToBitMask(item->type);
455 ALOGE("Duplicate map section of type %#x", item->type);
460 lastOffset = item->offset;
461 item++;
546 /* Perform byte-swapping and intra-item verification on string_id_item. */
548 DexStringId* item = (DexStringId*) ptr;
550 CHECK_PTR_RANGE(item, item + 1);
551 SWAP_OFFSET4(item->stringDataOff);
553 return item + 1;
556 /* Perform cross-item verification of string_id_item. */
558 const DexStringId* item = (const DexStringId*) ptr;
561 item->stringDataOff, kDexTypeStringDataItem)) {
569 const char* s1 = dexGetStringData(state->pDexFile, item);
576 return (void*) (item + 1);
579 /* Perform byte-swapping and intra-item verification on type_id_item. */
581 DexTypeId* item = (DexTypeId*) ptr;
583 CHECK_PTR_RANGE(item, item + 1);
584 SWAP_INDEX4(item->descriptorIdx, state->pHeader->stringIdsSize);
586 return item + 1;
589 /* Perform cross-item verification of type_id_item. */
591 const DexTypeId* item = (const DexTypeId*) ptr;
593 dexStringById(state->pDexFile, item->descriptorIdx);
603 if (item0->descriptorIdx >= item->descriptorIdx) {
605 item0->descriptorIdx, item->descriptorIdx);
610 return (void*) (item + 1);
613 /* Perform byte-swapping and intra-item verification on proto_id_item. */
615 DexProtoId* item = (DexProtoId*) ptr;
617 CHECK_PTR_RANGE(item, item + 1);
618 SWAP_INDEX4(item->shortyIdx, state->pHeader->stringIdsSize);
619 SWAP_INDEX4(item->returnTypeIdx, state->pHeader->typeIdsSize);
620 SWAP_OFFSET4(item->parametersOff);
622 return item + 1;
670 /* Perform cross-item verification of proto_id_item. */
672 const DexProtoId* item = (const DexProtoId*) ptr;
674 dexStringById(state->pDexFile, item->shortyIdx);
677 item->parametersOff, kDexTypeTypeList)) {
682 dexStringByTypeIdx(state->pDexFile, item->returnTypeIdx),
687 u4 protoIdx = item - state->pDexFile->pProtoIds;
721 if (item0->returnTypeIdx > item->returnTypeIdx) {
724 } else if (item0->returnTypeIdx == item->returnTypeIdx) {
760 return (void*) (item + 1);
763 /* Perform byte-swapping and intra-item verification on field_id_item. */
765 DexFieldId* item = (DexFieldId*) ptr;
767 CHECK_PTR_RANGE(item, item + 1);
768 SWAP_INDEX2(item->classIdx, state->pHeader->typeIdsSize);
769 SWAP_INDEX2(item->typeIdx, state->pHeader->typeIdsSize);
770 SWAP_INDEX4(item->nameIdx, state->pHeader->stringIdsSize);
772 return item + 1;
775 /* Perform cross-item verification of field_id_item. */
777 const DexFieldId* item = (const DexFieldId*) ptr;
780 s = dexStringByTypeIdx(state->pDexFile, item->classIdx);
786 s = dexStringByTypeIdx(state->pDexFile, item->typeIdx);
792 s = dexStringById(state->pDexFile, item->nameIdx);
804 if (item0->classIdx > item->classIdx) {
807 } else if (item0->classIdx < item->classIdx) {
812 if (item0->nameIdx > item->nameIdx) {
815 } else if (item0->nameIdx < item->nameIdx) {
821 if (item0->typeIdx >= item->typeIdx) {
832 return (void*) (item + 1);
835 /* Perform byte-swapping and intra-item verification on method_id_item. */
837 DexMethodId* item = (DexMethodId*) ptr;
839 CHECK_PTR_RANGE(item, item + 1);
840 SWAP_INDEX2(item->classIdx, state->pHeader->typeIdsSize);
841 SWAP_INDEX2(item->protoIdx, state->pHeader->protoIdsSize);
842 SWAP_INDEX4(item->nameIdx, state->pHeader->stringIdsSize);
844 return item + 1;
847 /* Perform cross-item verification of method_id_item. */
849 const DexMethodId* item = (const DexMethodId*) ptr;
852 s = dexStringByTypeIdx(state->pDexFile, item->classIdx);
858 s = dexStringById(state->pDexFile, item->nameIdx);
870 if (item0->classIdx > item->classIdx) {
873 } else if (item0->classIdx < item->classIdx) {
878 if (item0->nameIdx > item->nameIdx) {
881 } else if (item0->nameIdx < item->nameIdx) {
887 if (item0->protoIdx >= item->protoIdx) {
898 return (void*) (item + 1);
901 /* Perform byte-swapping and intra-item verification on class_def_item. */
903 DexClassDef* item = (DexClassDef*) ptr;
905 CHECK_PTR_RANGE(item, item + 1);
906 SWAP_INDEX4(item->classIdx, state->pHeader->typeIdsSize);
907 SWAP_FIELD4(item->accessFlags);
908 SWAP_INDEX4_OR_NOINDEX(item->superclassIdx, state->pHeader->typeIdsSize);
909 SWAP_OFFSET4(item->interfacesOff);
910 SWAP_INDEX4_OR_NOINDEX(item->sourceFileIdx, state->pHeader->stringIdsSize);
911 SWAP_OFFSET4(item->annotationsOff);
912 SWAP_OFFSET4(item->classDataOff);
914 if ((item->accessFlags & ~ACC_CLASS_MASK) != 0) {
916 ALOGV("Bogus class access flags %x", item->accessFlags);
917 item->accessFlags &= ACC_CLASS_MASK;
920 return item + 1;
973 /* Perform cross-item verification of class_def_item. */
975 const DexClassDef* item = (const DexClassDef*) ptr;
976 u4 classIdx = item->classIdx;
991 item
993 item->annotationsOff, kDexTypeAnnotationsDirectoryItem)
995 item->classDataOff, kDexTypeClassDataItem)
997 item->staticValuesOff, kDexTypeEncodedArrayItem);
1003 if (item->superclassIdx != kDexNoIndex) {
1004 descriptor = dexStringByTypeIdx(state->pDexFile, item->superclassIdx);
1012 dexGetInterfacesList(state->pDexFile, item);
1051 if (!verifyClassDataIsForDef(state, item->classDataOff, item->classIdx)) {
1056 if (!verifyAnnotationsDirectoryIsForDef(state, item->annotationsOff,
1057 item->classIdx)) {
1062 return (void*) (item + 1);
1066 * byte-swapping and intra-item verification on an
1069 DexFieldAnnotationsItem* item = (DexFieldAnnotationsItem*) addr;
1073 CHECK_LIST_SIZE(item, count, sizeof(DexFieldAnnotationsItem));
1076 SWAP_INDEX4(item->fieldIdx, state->pHeader->fieldIdsSize);
1077 SWAP_OFFSET4(item->annotationsOff);
1081 } else if (lastIdx >= item->fieldIdx) {
1083 item->fieldIdx);
1087 lastIdx = item->fieldIdx;
1088 item++;
1091 return (u1*) item;
1095 * byte-swapping and intra-item verification on an
1098 DexMethodAnnotationsItem* item = (DexMethodAnnotationsItem*) addr;
1102 CHECK_LIST_SIZE(item, count, sizeof(DexMethodAnnotationsItem));
1105 SWAP_INDEX4(item->methodIdx, state->pHeader->methodIdsSize);
1106 SWAP_OFFSET4(item->annotationsOff);
1110 } else if (lastIdx >= item->methodIdx) {
1112 item->methodIdx);
1116 lastIdx = item->methodIdx;
1117 item++;
1120 return (u1*) item;
1124 * byte-swapping and intra-item verification on an
1128 DexParameterAnnotationsItem* item = (DexParameterAnnotationsItem*) addr;
1132 CHECK_LIST_SIZE(item, count, sizeof(DexParameterAnnotationsItem));
1135 SWAP_INDEX4(item->methodIdx, state->pHeader->methodIdsSize);
1136 SWAP_OFFSET4(item->annotationsOff);
1140 } else if (lastIdx >= item->methodIdx) {
1142 item->methodIdx);
1146 lastIdx = item->methodIdx;
1147 item++;
1150 return (u1*) item;
1153 /* Perform byte-swapping and intra-item verification on
1156 DexAnnotationsDirectoryItem* item = (DexAnnotationsDirectoryItem*) ptr;
1158 CHECK_PTR_RANGE(item, item + 1);
1159 SWAP_OFFSET4(item->classAnnotationsOff);
1160 SWAP_FIELD4(item->fieldsSize);
1161 SWAP_FIELD4(item->methodsSize);
1162 SWAP_FIELD4(item->parametersSize);
1164 u1* addr = (u1*) (item + 1);
1166 if (item->fieldsSize != 0) {
1167 addr = swapFieldAnnotations(state, item->fieldsSize, addr);
1173 if (item->methodsSize != 0) {
1174 addr = swapMethodAnnotations(state, item->methodsSize, addr);
1180 if (item->parametersSize != 0) {
1181 addr = swapParameterAnnotations(state, item->parametersSize, addr);
1194 const DexFieldAnnotationsItem* item = (DexFieldAnnotationsItem*) addr;
1197 if (!verifyFieldDefiner(state, definingClass, item->fieldIdx)) {
1200 if (!dexDataMapVerify(state->pDataMap, item->annotationsOff,
1204 item++;
1207 return (const u1*) item;
1214 const DexMethodAnnotationsItem* item = (DexMethodAnnotationsItem*) addr;
1217 if (!verifyMethodDefiner(state, definingClass, item->methodIdx)) {
1220 if (!dexDataMapVerify(state->pDataMap, item->annotationsOff,
1224 item++;
1227 return (const u1*) item;
1234 const DexParameterAnnotationsItem* item =
1238 if (!verifyMethodDefiner(state, definingClass, item->methodIdx)) {
1241 if (!dexDataMapVerify(state->pDataMap, item->annotationsOff,
1245 item++;
1248 return (const u1*) item;
1253 * the definer of the first item in the data. */
1283 /* Perform cross-item verification of annotations_directory_item. */
1286 const DexAnnotationsDirectoryItem* item = (const DexAnnotationsDirectoryItem*) ptr;
1287 u4 definingClass = findFirstAnnotationsDirectoryDefiner(state, item);
1290 item->classAnnotationsOff, kDexTypeAnnotationSetItem)) {
1294 const u1* addr = (const u1*) (item + 1);
1296 if (item->fieldsSize != 0) {
1297 addr = crossVerifyFieldAnnotations(state, item->fieldsSize, addr,
1304 if (item->methodsSize != 0) {
1305 addr = crossVerifyMethodAnnotations(state, item->methodsSize, addr,
1312 if (item->parametersSize != 0) {
1313 addr = crossVerifyParameterAnnotations(state, item->parametersSize,
1323 /* Perform byte-swapping and intra-item verification on type_list. */
1344 /* Perform byte-swapping and intra-item verification on
1348 DexAnnotationSetRefItem* item;
1354 item = list->list;
1355 CHECK_LIST_SIZE(item, count, sizeof(DexAnnotationSetRefItem));
1358 SWAP_OFFSET4(item->annotationsOff);
1359 item++;
1362 return item;
1365 /* Perform cross-item verification of annotation_set_ref_list. */
1369 const DexAnnotationSetRefItem* item = list->list;
1374 item->annotationsOff, kDexTypeAnnotationSetItem)) {
1377 item++;
1380 return (void*) item;
1383 /* Perform byte-swapping and intra-item verification on
1387 u4* item;
1393 item = set->entries;
1394 CHECK_LIST_SIZE(item, count, sizeof(u4));
1397 SWAP_OFFSET4(*item);
1398 item++;
1401 return item;
1406 static u4 annotationItemTypeIdx(const DexAnnotationItem* item) {
1407 const u1* data = item->annotation;
1411 /* Perform cross-item verification of annotation_set_item. */
1559 /* Perform intra-item verification on class_data_item. */
1582 * of the first item in the data. */
1612 /* Perform cross-item verification of class_data_item. */
1812 /* Perform byte-swapping and intra-item verification on code_item. */
1814 DexCode* item = (DexCode*) ptr;
1818 CHECK_PTR_RANGE(item, item + 1);
1819 SWAP_FIELD2(item->registersSize);
1820 SWAP_FIELD2(item->insSize);
1821 SWAP_FIELD2(item->outsSize);
1822 SWAP_FIELD2(item->triesSize);
1823 SWAP_OFFSET4(item->debugInfoOff);
1824 SWAP_FIELD4(item->insnsSize);
1826 if (item->insSize > item->registersSize) {
1827 ALOGE("insSize (%u) > registersSize (%u)", item->insSize,
1828 item->registersSize);
1832 if ((item->outsSize > 5) && (item->outsSize > item->registersSize)) {
1840 ALOGE("outsSize (%u) > registersSize (%u)", item->outsSize,
1841 item->registersSize);
1845 count = item->insnsSize;
1846 insns = item->insns;
1854 if (item->triesSize == 0) {
1865 ptr = swapTriesAndCatches(state, item);
1871 /* Perform intra-item verification on string_data_item. */
1972 /* Perform intra-item verification on debug_info_item. */
2350 /* Perform intra-item verification on encoded_array_item. */
2355 /* Perform intra-item verification on annotation_item. */
2376 /* Perform cross-item verification on annotation_item. */
2390 * Function to visit an individual top-level item type.
2430 ALOGE("Trouble with item %d @ offset %#x", i, offset);
2435 ALOGE("Item %d @ offset %#x ends out of bounds", i, offset);
2519 * does all possible intra-item verification, that is, verification
2521 * items. The intra-item limitation is because at the time an item is
2527 const DexMapItem* item = pMap->list;
2533 u4 sectionOffset = item->offset;
2534 u4 sectionCount = item->size;
2535 u2 type = item->type;
2679 ALOGE("Unknown map item type %04x", type);
2688 item++;
2695 * Perform cross-item verification on everything that needs it. This
2701 const DexMapItem* item = pMap->list;
2706 u4 sectionOffset = item->offset;
2707 u4 sectionCount = item->size;
2709 switch (item->type) {
2718 // There is no need for cross-item verification for these.
2780 ALOGE("Unknown map item type %04x", item->type);
2786 ALOGE("Cross-item verify of section type %04x failed",
2787 item->type);
2790 item++;