Lines Matching refs:u4
49 static u4 endianSwapU4(u4 value) {
75 u4 fileLen;
84 u4* pDefinedClassBits;
92 static inline u4 fileOffset(const CheckState* state, const void* ptr) {
99 static inline void* filePointer(const CheckState* state, u4 offset) {
191 #_field, (u4)(_field), #_limit, (u4)(_limit)); \
210 #_field, (u4)(_field), #_limit, (u4)(_limit)); \
233 static bool verifyFieldDefiner(const CheckState* state, u4 definingClass,
234 u4 fieldIdx) {
240 static bool verifyMethodDefiner(const CheckState* state, u4 definingClass,
241 u4 methodIdx) {
259 static bool setDefinedClassBit(const CheckState* state, u4 typeIdx) {
260 u4 arrayIdx = typeIdx >> 5;
261 u4 bit = 1 << (typeIdx & 0x1f);
262 u4* element = &state->pDefinedClassBits[arrayIdx];
307 u4 linkOff = pHeader->linkOff;
308 u4 linkEnd = linkOff + pHeader->linkSize;
309 u4 dataOff = pHeader->dataOff;
310 u4 dataEnd = dataOff + pHeader->dataSize;
323 static bool checkHeaderSection(const CheckState* state, u4 sectionOffset,
324 u4 sectionCount, u4* endOffset) {
344 static u4 mapTypeToBitMask(int mapType) {
398 u4 count;
399 u4 dataItemCount = 0; // Total count of items in the data section.
400 u4 dataItemsLeft = state->pHeader->dataSize; // See use below.
401 u4 usedBits = 0; // Bit set: one bit per section
403 u4 lastOffset = 0;
431 u4 icount = item->size;
448 u4 bit = mapTypeToBitMask(item->type);
526 static bool checkMapSection(const CheckState* state, u4 sectionOffset,
527 u4 sectionCount, u4* endOffset) {
542 sectionOffset + sizeof(u4) + (pMap->size * sizeof(DexMapItem));
687 u4 protoIdx = item - state->pDexFile->pProtoIds;
733 u4 idx0 = dexParameterIteratorNextIndex(&iterator0);
734 u4 idx1 = dexParameterIteratorNextIndex(&iterator);
924 static u4 findFirstClassDataDefiner(const CheckState* state,
926 static u4 findFirstAnnotationsDirectoryDefiner(const CheckState* state,
931 static bool verifyClassDataIsForDef(const CheckState* state, u4 offset,
932 u4 definerIdx) {
950 u4 dataDefiner = findFirstClassDataDefiner(state, classData);
961 u4 offset, u4 definerIdx) {
968 u4 annoDefiner = findFirstAnnotationsDirectoryDefiner(state, dir);
976 u4 classIdx = item->classIdx;
1014 u4 size = interfaces->size;
1015 u4 i;
1038 u4 idx1 = dexTypeListGetIdx(interfaces, i);
1039 u4 j;
1041 u4 idx2 = dexTypeListGetIdx(interfaces, j);
1068 static u1* swapFieldAnnotations(const CheckState* state, u4 count, u1* addr) {
1071 u4 lastIdx = 0;
1097 static u1* swapMethodAnnotations(const CheckState* state, u4 count, u1* addr) {
1100 u4 lastIdx = 0;
1126 static u1* swapParameterAnnotations(const CheckState* state, u4 count,
1130 u4 lastIdx = 0;
1192 static const u1* crossVerifyFieldAnnotations(const CheckState* state, u4 count,
1193 const u1* addr, u4 definingClass) {
1213 u4 count, const u1* addr, u4 definingClass) {
1233 u4 count, const u1* addr, u4 definingClass) {
1254 static u4 findFirstAnnotationsDirectoryDefiner(const CheckState* state,
1287 u4 definingClass = findFirstAnnotationsDirectoryDefiner(state, item);
1328 u4 count;
1349 u4 count;
1387 u4* item;
1388 u4 count;
1394 CHECK_LIST_SIZE(item, count, sizeof(u4));
1406 static u4 annotationItemTypeIdx(const DexAnnotationItem* item) {
1415 u4 lastIdx = 0;
1427 u4 idx = annotationItemTypeIdx(annotation);
1444 static bool verifyFields(const CheckState* state, u4 size,
1446 u4 i;
1450 u4 accessFlags = field->accessFlags;
1471 static bool verifyMethods(const CheckState* state, u4 size,
1473 u4 i;
1480 u4 accessFlags = method->accessFlags;
1583 static u4 findFirstClassDataDefiner(const CheckState* state,
1586 u4 fieldIdx = classData->staticFields[0].fieldIdx;
1592 u4 fieldIdx = classData->instanceFields[0].fieldIdx;
1598 u4 methodIdx = classData->directMethods[0].methodIdx;
1604 u4 methodIdx = classData->virtualMethods[0].methodIdx;
1616 u4 definingClass = findFirstClassDataDefiner(state, classData);
1618 u4 i;
1660 static u4 setHandlerOffsAndVerify(const CheckState* state,
1661 DexCode* code, u4 firstOffset, u4 handlersSize, u4* handlerOffs) {
1664 u4 offset = firstOffset;
1666 u4 i;
1693 u4 typeIdx =
1703 u4 addr = readAndVerifyUnsignedLeb128(&ptr, fileEnd, &okay);
1717 u4 addr = readAndVerifyUnsignedLeb128(&ptr, fileEnd, &okay);
1742 u4 handlersSize =
1755 u4 handlerOffs[handlersSize]; // list of valid handlerOff values
1756 u4 endOffset = setHandlerOffsAndVerify(state, code,
1765 u4 count = code->triesSize;
1766 u4 lastEnd = 0;
1771 u4 i;
1816 u4 count;
1860 ALOGE("Non-zero padding: %#x", (u4) *insns);
1876 u4 utf16Size = readAndVerifyUnsignedLeb128(&data, fileEnd, &okay);
1877 u4 i;
1977 u4 i;
1986 u4 parametersSize =
2000 u4 parameterName =
2032 u4 idx;
2033 u4 regNum = readAndVerifyUnsignedLeb128(&data, fileEnd, &okay);
2055 u4 regNum = readAndVerifyUnsignedLeb128(&data, fileEnd, &okay);
2064 u4 idx;
2065 u4
2092 u4 idx = readAndVerifyUnsignedLeb128(&data, fileEnd, &okay);
2122 static u4 readUnsignedLittleEndian(const CheckState* state, const u1** pData,
2123 u4 size) {
2125 u4 result = 0;
2126 u4 i;
2131 result |= ((u4) *(data++)) << (i * 8);
2143 u4 size = readAndVerifyUnsignedLeb128(&data, state->fileEnd, &okay);
2168 u4 valueType = headerByte & kDexAnnotationValueTypeMask;
2169 u4 valueArg = headerByte >> kDexAnnotationValueArgShift;
2208 u4 idx = readUnsignedLittleEndian(state, &data, valueArg + 1);
2217 u4 idx = readUnsignedLittleEndian(state, &data, valueArg + 1);
2227 u4 idx = readUnsignedLittleEndian(state, &data, valueArg + 1);
2236 u4 idx = readUnsignedLittleEndian(state, &data, valueArg + 1);
2287 u4 idx = readAndVerifyUnsignedLeb128(&data, fileEnd, &okay);
2304 u4 size = readAndVerifyUnsignedLeb128(&data, fileEnd, &okay);
2305 u4 lastIdx = 0;
2400 u4 offset, u4 count, ItemVisitorFunction* func, u4 alignment,
2401 u4* nextOffset, int mapType) {
2402 u4 alignmentMask = alignment - 1;
2403 u4 i;
2408 u4 newOffset = (offset + alignmentMask) & ~alignmentMask;
2459 static bool iterateSection(CheckState* state, u4 offset, u4 count,
2460 ItemVisitorFunction* func, u4 alignment, u4* nextOffset) {
2470 u4 offset, u4 count, u4 expectedOffset, u4 expectedCount,
2471 ItemVisitorFunction* func, u4 alignment, u4* nextOffset) {
2491 static bool iterateDataSection(CheckState* state, u4 offset, u4 count,
2492 ItemVisitorFunction* func, u4 alignment, u4* nextOffset, int mapType) {
2493 u4 dataStart = state->pHeader->dataOff;
2494 u4 dataEnd = dataStart + state->pHeader->dataSize;
2528 u4 lastOffset = 0;
2529 u4 count = pMap->size;
2533 u4 sectionOffset = item->offset;
2534 u4 sectionCount = item->size;
2574 sizeof(u4), &lastOffset);
2581 sizeof(u4), &lastOffset);
2588 sizeof(u4), &lastOffset);
2595 sizeof(u4), &lastOffset);
2602 sizeof(u4), &lastOffset);
2609 sizeof(u4), &lastOffset);
2623 swapTypeList, sizeof(u4), &lastOffset, type);
2628 swapAnnotationSetRefList, sizeof(u4), &lastOffset,
2634 swapAnnotationSetItem, sizeof(u4), &lastOffset, type);
2645 swapCodeItem, sizeof(u4), &lastOffset, type);
2674 swapAnnotationsDirectoryItem, sizeof(u4), &lastOffset,
2702 u4 count = pMap->size;
2706 u4 sectionOffset = item->offset;
2707 u4 sectionCount = item->size;
2723 crossVerifyStringIdItem, sizeof(u4), NULL);
2728 crossVerifyTypeIdItem, sizeof(u4), NULL);
2733 crossVerifyProtoIdItem, sizeof(u4), NULL);
2738 crossVerifyFieldIdItem, sizeof(u4), NULL);
2743 crossVerifyMethodIdItem, sizeof(u4), NULL);
2749 u4 definedClassBits[arraySize];
2750 memset(definedClassBits, 0, arraySize * sizeof(u4));
2754 crossVerifyClassDefItem, sizeof(u4), NULL);
2761 crossVerifyAnnotationSetRefList, sizeof(u4), NULL);
2766 crossVerifyAnnotationSetItem, sizeof(u4), NULL);
2776 crossVerifyAnnotationsDirectoryItem, sizeof(u4), NULL);
2872 u4 storedFileSize = SWAP4(pHeader->fileSize);
2873 u4 expectedChecksum = SWAP4(pHeader->checksum);