diff options
Diffstat (limited to 'libdex/DexSwapVerify.cpp')
-rw-r--r-- | libdex/DexSwapVerify.cpp | 264 |
1 files changed, 132 insertions, 132 deletions
diff --git a/libdex/DexSwapVerify.cpp b/libdex/DexSwapVerify.cpp index 18445b25e..1835e9ba9 100644 --- a/libdex/DexSwapVerify.cpp +++ b/libdex/DexSwapVerify.cpp @@ -299,7 +299,7 @@ static bool swapDexHeader(const CheckState* state, DexHeader* pHeader) SWAP_OFFSET4(pHeader->dataOff); if (pHeader->endianTag != kDexEndianConstant) { - LOGE("Unexpected endian_tag: %#x", pHeader->endianTag); + ALOGE("Unexpected endian_tag: %#x", pHeader->endianTag); return false; } @@ -323,12 +323,12 @@ static bool swapDexHeader(const CheckState* state, DexHeader* pHeader) static bool checkHeaderSection(const CheckState* state, u4 sectionOffset, u4 sectionCount, u4* endOffset) { if (sectionCount != 1) { - LOGE("Multiple header items"); + ALOGE("Multiple header items"); return false; } if (sectionOffset != 0) { - LOGE("Header at %#x; not at start of file", sectionOffset); + ALOGE("Header at %#x; not at start of file", sectionOffset); return false; } @@ -362,7 +362,7 @@ static u4 mapTypeToBitMask(int mapType) { case kDexTypeEncodedArrayItem: return 1 << 16; case kDexTypeAnnotationsDirectoryItem: return 1 << 17; default: { - LOGE("Unknown map item type %04x", mapType); + ALOGE("Unknown map item type %04x", mapType); return 0; } } @@ -416,13 +416,13 @@ static bool swapMap(CheckState* state, DexMapList* pMap) if (first) { first = false; } else if (lastOffset >= item->offset) { - LOGE("Out-of-order map item: %#x then %#x", + ALOGE("Out-of-order map item: %#x then %#x", lastOffset, item->offset); return false; } if (item->offset >= state->pHeader->fileSize) { - LOGE("Map item after end of file: %x, size %#x", + ALOGE("Map item after end of file: %x, size %#x", item->offset, state->pHeader->fileSize); return false; } @@ -436,7 +436,7 @@ static bool swapMap(CheckState* state, DexMapList* pMap) * the data section. */ if (icount > dataItemsLeft) { - LOGE("Unrealistically many items in the data section: " + ALOGE("Unrealistically many items in the data section: " "at least %d", dataItemCount + icount); return false; } @@ -452,7 +452,7 @@ static bool swapMap(CheckState* state, DexMapList* pMap) } if ((usedBits & bit) != 0) { - LOGE("Duplicate map section of type %#x", item->type); + ALOGE("Duplicate map section of type %#x", item->type); return false; } @@ -462,60 +462,60 @@ static bool swapMap(CheckState* state, DexMapList* pMap) } if ((usedBits & mapTypeToBitMask(kDexTypeHeaderItem)) == 0) { - LOGE("Map is missing header entry"); + ALOGE("Map is missing header entry"); return false; } if ((usedBits & mapTypeToBitMask(kDexTypeMapList)) == 0) { - LOGE("Map is missing map_list entry"); + ALOGE("Map is missing map_list entry"); return false; } if (((usedBits & mapTypeToBitMask(kDexTypeStringIdItem)) == 0) && ((state->pHeader->stringIdsOff != 0) || (state->pHeader->stringIdsSize != 0))) { - LOGE("Map is missing string_ids entry"); + ALOGE("Map is missing string_ids entry"); return false; } if (((usedBits & mapTypeToBitMask(kDexTypeTypeIdItem)) == 0) && ((state->pHeader->typeIdsOff != 0) || (state->pHeader->typeIdsSize != 0))) { - LOGE("Map is missing type_ids entry"); + ALOGE("Map is missing type_ids entry"); return false; } if (((usedBits & mapTypeToBitMask(kDexTypeProtoIdItem)) == 0) && ((state->pHeader->protoIdsOff != 0) || (state->pHeader->protoIdsSize != 0))) { - LOGE("Map is missing proto_ids entry"); + ALOGE("Map is missing proto_ids entry"); return false; } if (((usedBits & mapTypeToBitMask(kDexTypeFieldIdItem)) == 0) && ((state->pHeader->fieldIdsOff != 0) || (state->pHeader->fieldIdsSize != 0))) { - LOGE("Map is missing field_ids entry"); + ALOGE("Map is missing field_ids entry"); return false; } if (((usedBits & mapTypeToBitMask(kDexTypeMethodIdItem)) == 0) && ((state->pHeader->methodIdsOff != 0) || (state->pHeader->methodIdsSize != 0))) { - LOGE("Map is missing method_ids entry"); + ALOGE("Map is missing method_ids entry"); return false; } if (((usedBits & mapTypeToBitMask(kDexTypeClassDefItem)) == 0) && ((state->pHeader->classDefsOff != 0) || (state->pHeader->classDefsSize != 0))) { - LOGE("Map is missing class_defs entry"); + ALOGE("Map is missing class_defs entry"); return false; } state->pDataMap = dexDataMapAlloc(dataItemCount); if (state->pDataMap == NULL) { - LOGE("Unable to allocate data map (size %#x)", dataItemCount); + ALOGE("Unable to allocate data map (size %#x)", dataItemCount); return false; } @@ -526,12 +526,12 @@ static bool swapMap(CheckState* state, DexMapList* pMap) static bool checkMapSection(const CheckState* state, u4 sectionOffset, u4 sectionCount, u4* endOffset) { if (sectionCount != 1) { - LOGE("Multiple map list items"); + ALOGE("Multiple map list items"); return false; } if (sectionOffset != state->pHeader->mapOff) { - LOGE("Map not at header-defined offset: %#x, expected %#x", + ALOGE("Map not at header-defined offset: %#x, expected %#x", sectionOffset, state->pHeader->mapOff); return false; } @@ -568,7 +568,7 @@ static void* crossVerifyStringIdItem(const CheckState* state, void* ptr) { const char* s0 = dexGetStringData(state->pDexFile, item0); const char* s1 = dexGetStringData(state->pDexFile, item); if (dexUtf8Cmp(s0, s1) >= 0) { - LOGE("Out-of-order string_ids: '%s' then '%s'", s0, s1); + ALOGE("Out-of-order string_ids: '%s' then '%s'", s0, s1); return NULL; } } @@ -593,7 +593,7 @@ static void* crossVerifyTypeIdItem(const CheckState* state, void* ptr) { dexStringById(state->pDexFile, item->descriptorIdx); if (!dexIsValidTypeDescriptor(descriptor)) { - LOGE("Invalid type descriptor: '%s'", descriptor); + ALOGE("Invalid type descriptor: '%s'", descriptor); return NULL; } @@ -601,7 +601,7 @@ static void* crossVerifyTypeIdItem(const CheckState* state, void* ptr) { if (item0 != NULL) { // Check ordering. This relies on string_ids being in order. if (item0->descriptorIdx >= item->descriptorIdx) { - LOGE("Out-of-order type_ids: %#x then %#x", + ALOGE("Out-of-order type_ids: %#x then %#x", item0->descriptorIdx, item->descriptorIdx); return NULL; } @@ -630,7 +630,7 @@ static bool shortyDescMatch(char shorty, const char* descriptor, bool switch (shorty) { case 'V': { if (!isReturnType) { - LOGE("Invalid use of void"); + ALOGE("Invalid use of void"); return false; } // Fall through. @@ -644,7 +644,7 @@ static bool shortyDescMatch(char shorty, const char* descriptor, bool case 'S': case 'Z': { if ((descriptor[0] != shorty) || (descriptor[1] != '\0')) { - LOGE("Shorty vs. primitive type mismatch: '%c', '%s'", + ALOGE("Shorty vs. primitive type mismatch: '%c', '%s'", shorty, descriptor); return false; } @@ -652,14 +652,14 @@ static bool shortyDescMatch(char shorty, const char* descriptor, bool } case 'L': { if ((descriptor[0] != 'L') && (descriptor[0] != '[')) { - LOGE("Shorty vs. type mismatch: '%c', '%s'", + ALOGE("Shorty vs. type mismatch: '%c', '%s'", shorty, descriptor); return false; } break; } default: { - LOGE("Bogus shorty: '%c'", shorty); + ALOGE("Bogus shorty: '%c'", shorty); return false; } } @@ -699,7 +699,7 @@ static void* crossVerifyProtoIdItem(const CheckState* state, void* ptr) { } if (*shorty == '\0') { - LOGE("Shorty is too short"); + ALOGE("Shorty is too short"); return NULL; } @@ -711,7 +711,7 @@ static void* crossVerifyProtoIdItem(const CheckState* state, void* ptr) { } if (*shorty != '\0') { - LOGE("Shorty is too long"); + ALOGE("Shorty is too long"); return NULL; } @@ -719,7 +719,7 @@ static void* crossVerifyProtoIdItem(const CheckState* state, void* ptr) { if (item0 != NULL) { // Check ordering. This relies on type_ids being in order. if (item0->returnTypeIdx > item->returnTypeIdx) { - LOGE("Out-of-order proto_id return types"); + ALOGE("Out-of-order proto_id return types"); return NULL; } else if (item0->returnTypeIdx == item->returnTypeIdx) { bool badOrder = false; @@ -751,7 +751,7 @@ static void* crossVerifyProtoIdItem(const CheckState* state, void* ptr) { } if (badOrder) { - LOGE("Out-of-order proto_id arguments"); + ALOGE("Out-of-order proto_id arguments"); return NULL; } } @@ -779,19 +779,19 @@ static void* crossVerifyFieldIdItem(const CheckState* state, void* ptr) { s = dexStringByTypeIdx(state->pDexFile, item->classIdx); if (!dexIsClassDescriptor(s)) { - LOGE("Invalid descriptor for class_idx: '%s'", s); + ALOGE("Invalid descriptor for class_idx: '%s'", s); return NULL; } s = dexStringByTypeIdx(state->pDexFile, item->typeIdx); if (!dexIsFieldDescriptor(s)) { - LOGE("Invalid descriptor for type_idx: '%s'", s); + ALOGE("Invalid descriptor for type_idx: '%s'", s); return NULL; } s = dexStringById(state->pDexFile, item->nameIdx); if (!dexIsValidMemberName(s)) { - LOGE("Invalid name: '%s'", s); + ALOGE("Invalid name: '%s'", s); return NULL; } @@ -824,7 +824,7 @@ static void* crossVerifyFieldIdItem(const CheckState* state, void* ptr) { } if (bogus) { - LOGE("Out-of-order field_ids"); + ALOGE("Out-of-order field_ids"); return NULL; } } @@ -851,13 +851,13 @@ static void* crossVerifyMethodIdItem(const CheckState* state, void* ptr) { s = dexStringByTypeIdx(state->pDexFile, item->classIdx); if (!dexIsReferenceDescriptor(s)) { - LOGE("Invalid descriptor for class_idx: '%s'", s); + ALOGE("Invalid descriptor for class_idx: '%s'", s); return NULL; } s = dexStringById(state->pDexFile, item->nameIdx); if (!dexIsValidMemberName(s)) { - LOGE("Invalid name: '%s'", s); + ALOGE("Invalid name: '%s'", s); return NULL; } @@ -890,7 +890,7 @@ static void* crossVerifyMethodIdItem(const CheckState* state, void* ptr) { } if (bogus) { - LOGE("Out-of-order method_ids"); + ALOGE("Out-of-order method_ids"); return NULL; } } @@ -971,12 +971,12 @@ static void* crossVerifyClassDefItem(const CheckState* state, void* ptr) { const char* descriptor = dexStringByTypeIdx(state->pDexFile, classIdx); if (!dexIsClassDescriptor(descriptor)) { - LOGE("Invalid class: '%s'", descriptor); + ALOGE("Invalid class: '%s'", descriptor); return NULL; } if (setDefinedClassBit(state, classIdx)) { - LOGE("Duplicate class definition: '%s'", descriptor); + ALOGE("Duplicate class definition: '%s'", descriptor); return NULL; } @@ -997,7 +997,7 @@ static void* crossVerifyClassDefItem(const CheckState* state, void* ptr) { if (item->superclassIdx != kDexNoIndex) { descriptor = dexStringByTypeIdx(state->pDexFile, item->superclassIdx); if (!dexIsClassDescriptor(descriptor)) { - LOGE("Invalid superclass: '%s'", descriptor); + ALOGE("Invalid superclass: '%s'", descriptor); return NULL; } } @@ -1016,7 +1016,7 @@ static void* crossVerifyClassDefItem(const CheckState* state, void* ptr) { descriptor = dexStringByTypeIdx(state->pDexFile, dexTypeListGetIdx(interfaces, i)); if (!dexIsClassDescriptor(descriptor)) { - LOGE("Invalid interface: '%s'", descriptor); + ALOGE("Invalid interface: '%s'", descriptor); return NULL; } } @@ -1034,7 +1034,7 @@ static void* crossVerifyClassDefItem(const CheckState* state, void* ptr) { for (j = 0; j < i; j++) { u4 idx2 = dexTypeListGetIdx(interfaces, j); if (idx1 == idx2) { - LOGE("Duplicate interface: '%s'", + ALOGE("Duplicate interface: '%s'", dexStringByTypeIdx(state->pDexFile, idx1)); return NULL; } @@ -1043,13 +1043,13 @@ static void* crossVerifyClassDefItem(const CheckState* state, void* ptr) { } if (!verifyClassDataIsForDef(state, item->classDataOff, item->classIdx)) { - LOGE("Invalid class_data_item"); + ALOGE("Invalid class_data_item"); return NULL; } if (!verifyAnnotationsDirectoryIsForDef(state, item->annotationsOff, item->classIdx)) { - LOGE("Invalid annotations_directory_item"); + ALOGE("Invalid annotations_directory_item"); return NULL; } @@ -1073,7 +1073,7 @@ static u1* swapFieldAnnotations(const CheckState* state, u4 count, u1* addr) { if (first) { first = false; } else if (lastIdx >= item->fieldIdx) { - LOGE("Out-of-order field_idx: %#x then %#x", lastIdx, + ALOGE("Out-of-order field_idx: %#x then %#x", lastIdx, item->fieldIdx); return NULL; } @@ -1102,7 +1102,7 @@ static u1* swapMethodAnnotations(const CheckState* state, u4 count, u1* addr) { if (first) { first = false; } else if (lastIdx >= item->methodIdx) { - LOGE("Out-of-order method_idx: %#x then %#x", lastIdx, + ALOGE("Out-of-order method_idx: %#x then %#x", lastIdx, item->methodIdx); return NULL; } @@ -1132,7 +1132,7 @@ static u1* swapParameterAnnotations(const CheckState* state, u4 count, if (first) { first = false; } else if (lastIdx >= item->methodIdx) { - LOGE("Out-of-order method_idx: %#x then %#x", lastIdx, + ALOGE("Out-of-order method_idx: %#x then %#x", lastIdx, item->methodIdx); return NULL; } @@ -1423,7 +1423,7 @@ static void* crossVerifyAnnotationSetItem(const CheckState* state, void* ptr) { if (first) { first = false; } else if (lastIdx >= idx) { - LOGE("Out-of-order entry types: %#x then %#x", + ALOGE("Out-of-order entry types: %#x then %#x", lastIdx, idx); return NULL; } @@ -1447,12 +1447,12 @@ static bool verifyFields(const CheckState* state, u4 size, CHECK_INDEX(field->fieldIdx, state->pHeader->fieldIdsSize); if (isStatic != expectStatic) { - LOGE("Field in wrong list @ %d", i); + ALOGE("Field in wrong list @ %d", i); return false; } if ((accessFlags & ~ACC_FIELD_MASK) != 0) { - LOGE("Bogus field access flags %x @ %d", accessFlags, i); + ALOGE("Bogus field access flags %x @ %d", accessFlags, i); return false; } } @@ -1478,24 +1478,24 @@ static bool verifyMethods(const CheckState* state, u4 size, bool allowSynchronized = (accessFlags & ACC_NATIVE) != 0; if (isDirect != expectDirect) { - LOGE("Method in wrong list @ %d", i); + ALOGE("Method in wrong list @ %d", i); return false; } if (((accessFlags & ~ACC_METHOD_MASK) != 0) || (isSynchronized && !allowSynchronized)) { - LOGE("Bogus method access flags %x @ %d", accessFlags, i); + ALOGE("Bogus method access flags %x @ %d", accessFlags, i); return false; } if (expectCode) { if (method->codeOff == 0) { - LOGE("Unexpected zero code_off for access_flags %x", + ALOGE("Unexpected zero code_off for access_flags %x", accessFlags); return false; } } else if (method->codeOff != 0) { - LOGE("Unexpected non-zero code_off %#x for access_flags %x", + ALOGE("Unexpected non-zero code_off %#x for access_flags %x", method->codeOff, accessFlags); return false; } @@ -1513,7 +1513,7 @@ static bool verifyClassDataItem0(const CheckState* state, classData->staticFields, true); if (!okay) { - LOGE("Trouble with static fields"); + ALOGE("Trouble with static fields"); return false; } @@ -1521,7 +1521,7 @@ static bool verifyClassDataItem0(const CheckState* state, classData->instanceFields, false); if (!okay) { - LOGE("Trouble with instance fields"); + ALOGE("Trouble with instance fields"); return false; } @@ -1529,7 +1529,7 @@ static bool verifyClassDataItem0(const CheckState* state, classData->directMethods, true); if (!okay) { - LOGE("Trouble with direct methods"); + ALOGE("Trouble with direct methods"); return false; } @@ -1537,7 +1537,7 @@ static bool verifyClassDataItem0(const CheckState* state, classData->virtualMethods, false); if (!okay) { - LOGE("Trouble with virtual methods"); + ALOGE("Trouble with virtual methods"); return false; } @@ -1550,7 +1550,7 @@ static void* intraVerifyClassDataItem(const CheckState* state, void* ptr) { DexClassData* classData = dexReadAndVerifyClassData(&data, state->fileEnd); if (classData == NULL) { - LOGE("Unable to parse class_data_item"); + ALOGE("Unable to parse class_data_item"); return NULL; } @@ -1659,12 +1659,12 @@ static u4 setHandlerOffsAndVerify(const CheckState* state, bool catchAll; if (!okay) { - LOGE("Bogus size"); + ALOGE("Bogus size"); return 0; } if ((size < -65536) || (size > 65536)) { - LOGE("Invalid size: %d", size); + ALOGE("Invalid size: %d", size); return 0; } @@ -1682,7 +1682,7 @@ static u4 setHandlerOffsAndVerify(const CheckState* state, readAndVerifyUnsignedLeb128(&ptr, fileEnd, &okay); if (!okay) { - LOGE("Bogus type_idx"); + ALOGE("Bogus type_idx"); return 0; } @@ -1691,12 +1691,12 @@ static u4 setHandlerOffsAndVerify(const CheckState* state, u4 addr = readAndVerifyUnsignedLeb128(&ptr, fileEnd, &okay); if (!okay) { - LOGE("Bogus addr"); + ALOGE("Bogus addr"); return 0; } if (addr >= code->insnsSize) { - LOGE("Invalid addr: %#x", addr); + ALOGE("Invalid addr: %#x", addr); return 0; } } @@ -1705,12 +1705,12 @@ static u4 setHandlerOffsAndVerify(const CheckState* state, u4 addr = readAndVerifyUnsignedLeb128(&ptr, fileEnd, &okay); if (!okay) { - LOGE("Bogus catch_all_addr"); + ALOGE("Bogus catch_all_addr"); return 0; } if (addr >= code->insnsSize) { - LOGE("Invalid catch_all_addr: %#x", addr); + ALOGE("Invalid catch_all_addr: %#x", addr); return 0; } } @@ -1731,12 +1731,12 @@ static void* swapTriesAndCatches(const CheckState* state, DexCode* code) { readAndVerifyUnsignedLeb128(&encodedPtr, state->fileEnd, &okay); if (!okay) { - LOGE("Bogus handlers_size"); + ALOGE("Bogus handlers_size"); return NULL; } if ((handlersSize == 0) || (handlersSize >= 65536)) { - LOGE("Invalid handlers_size: %d", handlersSize); + ALOGE("Invalid handlers_size: %d", handlersSize); return NULL; } @@ -1763,12 +1763,12 @@ static void* swapTriesAndCatches(const CheckState* state, DexCode* code) { SWAP_FIELD2(tries->handlerOff); if (tries->startAddr < lastEnd) { - LOGE("Out-of-order try"); + ALOGE("Out-of-order try"); return NULL; } if (tries->startAddr >= code->insnsSize) { - LOGE("Invalid start_addr: %#x", tries->startAddr); + ALOGE("Invalid start_addr: %#x", tries->startAddr); return NULL; } @@ -1779,14 +1779,14 @@ static void* swapTriesAndCatches(const CheckState* state, DexCode* code) { } if (i == handlersSize) { - LOGE("Bogus handler offset: %#x", tries->handlerOff); + ALOGE("Bogus handler offset: %#x", tries->handlerOff); return NULL; } lastEnd = tries->startAddr + tries->insnCount; if (lastEnd > code->insnsSize) { - LOGE("Invalid insn_count: %#x (end addr %#x)", + ALOGE("Invalid insn_count: %#x (end addr %#x)", tries->insnCount, lastEnd); return NULL; } @@ -1812,7 +1812,7 @@ static void* swapCodeItem(const CheckState* state, void* ptr) { SWAP_FIELD4(item->insnsSize); if (item->insSize > item->registersSize) { - LOGE("insSize (%u) > registersSize (%u)", item->insSize, + ALOGE("insSize (%u) > registersSize (%u)", item->insSize, item->registersSize); return NULL; } @@ -1825,7 +1825,7 @@ static void* swapCodeItem(const CheckState* state, void* ptr) { * list. Longer parameter lists, though, need to be represented * in-order in the register file. */ - LOGE("outsSize (%u) > registersSize (%u)", item->outsSize, + ALOGE("outsSize (%u) > registersSize (%u)", item->outsSize, item->registersSize); return NULL; } @@ -1845,7 +1845,7 @@ static void* swapCodeItem(const CheckState* state, void* ptr) { if ((((u4) insns) & 3) != 0) { // Four-byte alignment for the tries. Verify the spacer is a 0. if (*insns != 0) { - LOGE("Non-zero padding: %#x", (u4) *insns); + ALOGE("Non-zero padding: %#x", (u4) *insns); return NULL; } } @@ -1865,13 +1865,13 @@ static void* intraVerifyStringDataItem(const CheckState* state, void* ptr) { u4 i; if (!okay) { - LOGE("Bogus utf16_size"); + ALOGE("Bogus utf16_size"); return NULL; } for (i = 0; i < utf16Size; i++) { if (data >= fileEnd) { - LOGE("String data would go beyond end-of-file"); + ALOGE("String data would go beyond end-of-file"); return NULL; } @@ -1882,7 +1882,7 @@ static void* intraVerifyStringDataItem(const CheckState* state, void* ptr) { case 0x00: { // Special case of bit pattern 0xxx. if (byte1 == 0) { - LOGE("String shorter than indicated utf16_size %#x", + ALOGE("String shorter than indicated utf16_size %#x", utf16Size); return NULL; } @@ -1908,25 +1908,25 @@ static void* intraVerifyStringDataItem(const CheckState* state, void* ptr) { * Note: 1111 is valid for normal UTF-8, but not the * modified UTF-8 used here. */ - LOGE("Illegal start byte %#x", byte1); + ALOGE("Illegal start byte %#x", byte1); return NULL; } case 0x0e: { // Bit pattern 1110, so there are two additional bytes. u1 byte2 = *(data++); if ((byte2 & 0xc0) != 0x80) { - LOGE("Illegal continuation byte %#x", byte2); + ALOGE("Illegal continuation byte %#x", byte2); return NULL; } u1 byte3 = *(data++); if ((byte3 & 0xc0) != 0x80) { - LOGE("Illegal continuation byte %#x", byte3); + ALOGE("Illegal continuation byte %#x", byte3); return NULL; } u2 value = ((byte1 & 0x0f) << 12) | ((byte2 & 0x3f) << 6) | (byte3 & 0x3f); if (value < 0x800) { - LOGE("Illegal representation for value %x", value); + ALOGE("Illegal representation for value %x", value); return NULL; } break; @@ -1936,12 +1936,12 @@ static void* intraVerifyStringDataItem(const CheckState* state, void* ptr) { // Bit pattern 110x, so there is one additional byte. u1 byte2 = *(data++); if ((byte2 & 0xc0) != 0x80) { - LOGE("Illegal continuation byte %#x", byte2); + ALOGE("Illegal continuation byte %#x", byte2); return NULL; } u2 value = ((byte1 & 0x1f) << 6) | (byte2 & 0x3f); if ((value != 0) && (value < 0x80)) { - LOGE("Illegal representation for value %x", value); + ALOGE("Illegal representation for value %x", value); return NULL; } break; @@ -1950,7 +1950,7 @@ static void* intraVerifyStringDataItem(const CheckState* state, void* ptr) { } if (*(data++) != '\0') { - LOGE("String longer than indicated utf16_size %#x", utf16Size); + ALOGE("String longer than indicated utf16_size %#x", utf16Size); return NULL; } @@ -1967,7 +1967,7 @@ static void* intraVerifyDebugInfoItem(const CheckState* state, void* ptr) { readAndVerifyUnsignedLeb128(&data, fileEnd, &okay); if (!okay) { - LOGE("Bogus line_start"); + ALOGE("Bogus line_start"); return NULL; } @@ -1975,12 +1975,12 @@ static void* intraVerifyDebugInfoItem(const CheckState* state, void* ptr) { readAndVerifyUnsignedLeb128(&data, fileEnd, &okay); if (!okay) { - LOGE("Bogus parameters_size"); + ALOGE("Bogus parameters_size"); return NULL; } if (parametersSize > 65536) { - LOGE("Invalid parameters_size: %#x", parametersSize); + ALOGE("Invalid parameters_size: %#x", parametersSize); return NULL; } @@ -1989,7 +1989,7 @@ static void* intraVerifyDebugInfoItem(const CheckState* state, void* ptr) { readAndVerifyUnsignedLeb128(&data, fileEnd, &okay); if (!okay) { - LOGE("Bogus parameter_name"); + ALOGE("Bogus parameter_name"); return NULL; } @@ -2091,7 +2091,7 @@ static void* intraVerifyDebugInfoItem(const CheckState* state, void* ptr) { } if (!okay) { - LOGE("Bogus syntax for opcode %02x", opcode); + ALOGE("Bogus syntax for opcode %02x", opcode); return NULL; } } @@ -2131,14 +2131,14 @@ static const u1* verifyEncodedArray(const CheckState* state, u4 size = readAndVerifyUnsignedLeb128(&data, state->fileEnd, &okay); if (!okay) { - LOGE("Bogus encoded_array size"); + ALOGE("Bogus encoded_array size"); return NULL; } while (size--) { data = verifyEncodedValue(state, data, crossVerify); if (data == NULL) { - LOGE("Bogus encoded_array value"); + ALOGE("Bogus encoded_array value"); return NULL; } } @@ -2159,7 +2159,7 @@ static const u1* verifyEncodedValue(const CheckState* state, switch (valueType) { case kDexAnnotationByte: { if (valueArg != 0) { - LOGE("Bogus byte size %#x", valueArg); + ALOGE("Bogus byte size %#x", valueArg); return NULL; } data++; @@ -2168,7 +2168,7 @@ static const u1* verifyEncodedValue(const CheckState* state, case kDexAnnotationShort: case kDexAnnotationChar: { if (valueArg > 1) { - LOGE("Bogus char/short size %#x", valueArg); + ALOGE("Bogus char/short size %#x", valueArg); return NULL; } data += valueArg + 1; @@ -2177,7 +2177,7 @@ static const u1* verifyEncodedValue(const CheckState* state, case kDexAnnotationInt: case kDexAnnotationFloat: { if (valueArg > 3) { - LOGE("Bogus int/float size %#x", valueArg); + ALOGE("Bogus int/float size %#x", valueArg); return NULL; } data += valueArg + 1; @@ -2190,7 +2190,7 @@ static const u1* verifyEncodedValue(const CheckState* state, } case kDexAnnotationString: { if (valueArg > 3) { - LOGE("Bogus string size %#x", valueArg); + ALOGE("Bogus string size %#x", valueArg); return NULL; } u4 idx = readUnsignedLittleEndian(state, &data, valueArg + 1); @@ -2199,7 +2199,7 @@ static const u1* verifyEncodedValue(const CheckState* state, } case kDexAnnotationType: { if (valueArg > 3) { - LOGE("Bogus type size %#x", valueArg); + ALOGE("Bogus type size %#x", valueArg); return NULL; } u4 idx = readUnsignedLittleEndian(state, &data, valueArg + 1); @@ -2209,7 +2209,7 @@ static const u1* verifyEncodedValue(const CheckState* state, case kDexAnnotationField: case kDexAnnotationEnum: { if (valueArg > 3) { - LOGE("Bogus field/enum size %#x", valueArg); + ALOGE("Bogus field/enum size %#x", valueArg); return NULL; } u4 idx = readUnsignedLittleEndian(state, &data, valueArg + 1); @@ -2218,7 +2218,7 @@ static const u1* verifyEncodedValue(const CheckState* state, } case kDexAnnotationMethod: { if (valueArg > 3) { - LOGE("Bogus method size %#x", valueArg); + ALOGE("Bogus method size %#x", valueArg); return NULL; } u4 idx = readUnsignedLittleEndian(state, &data, valueArg + 1); @@ -2227,7 +2227,7 @@ static const u1* verifyEncodedValue(const CheckState* state, } case kDexAnnotationArray: { if (valueArg != 0) { - LOGE("Bogus array value_arg %#x", valueArg); + ALOGE("Bogus array value_arg %#x", valueArg); return NULL; } data = verifyEncodedArray(state, data, crossVerify); @@ -2235,7 +2235,7 @@ static const u1* verifyEncodedValue(const CheckState* state, } case kDexAnnotationAnnotation: { if (valueArg != 0) { - LOGE("Bogus annotation value_arg %#x", valueArg); + ALOGE("Bogus annotation value_arg %#x", valueArg); return NULL; } data = verifyEncodedAnnotation(state, data, crossVerify); @@ -2243,7 +2243,7 @@ static const u1* verifyEncodedValue(const CheckState* state, } case kDexAnnotationNull: { if (valueArg != 0) { - LOGE("Bogus null value_arg %#x", valueArg); + ALOGE("Bogus null value_arg %#x", valueArg); return NULL; } // Nothing else to do for this type. @@ -2251,14 +2251,14 @@ static const u1* verifyEncodedValue(const CheckState* state, } case kDexAnnotationBoolean: { if (valueArg > 1) { - LOGE("Bogus boolean value_arg %#x", valueArg); + ALOGE("Bogus boolean value_arg %#x", valueArg); return NULL; } // Nothing else to do for this type. break; } default: { - LOGE("Bogus value_type %#x", valueType); + ALOGE("Bogus value_type %#x", valueType); return NULL; } } @@ -2275,7 +2275,7 @@ static const u1* verifyEncodedAnnotation(const CheckState* state, u4 idx = readAndVerifyUnsignedLeb128(&data, fileEnd, &okay); if (!okay) { - LOGE("Bogus encoded_annotation type_idx"); + ALOGE("Bogus encoded_annotation type_idx"); return NULL; } @@ -2284,7 +2284,7 @@ static const u1* verifyEncodedAnnotation(const CheckState* state, if (crossVerify) { const char* descriptor = dexStringByTypeIdx(state->pDexFile, idx); if (!dexIsClassDescriptor(descriptor)) { - LOGE("Bogus annotation type: '%s'", descriptor); + ALOGE("Bogus annotation type: '%s'", descriptor); return NULL; } } @@ -2294,7 +2294,7 @@ static const u1* verifyEncodedAnnotation(const CheckState* state, bool first = true; if (!okay) { - LOGE("Bogus encoded_annotation size"); + ALOGE("Bogus encoded_annotation size"); return NULL; } @@ -2302,7 +2302,7 @@ static const u1* verifyEncodedAnnotation(const CheckState* state, idx = readAndVerifyUnsignedLeb128(&data, fileEnd, &okay); if (!okay) { - LOGE("Bogus encoded_annotation name_idx"); + ALOGE("Bogus encoded_annotation name_idx"); return NULL; } @@ -2311,7 +2311,7 @@ static const u1* verifyEncodedAnnotation(const CheckState* state, if (crossVerify) { const char* name = dexStringById(state->pDexFile, idx); if (!dexIsValidMemberName(name)) { - LOGE("Bogus annotation member name: '%s'", name); + ALOGE("Bogus annotation member name: '%s'", name); return NULL; } } @@ -2319,7 +2319,7 @@ static const u1* verifyEncodedAnnotation(const CheckState* state, if (first) { first = false; } else if (lastIdx >= idx) { - LOGE("Out-of-order encoded_annotation name_idx: %#x then %#x", + ALOGE("Out-of-order encoded_annotation name_idx: %#x then %#x", lastIdx, idx); return NULL; } @@ -2353,7 +2353,7 @@ static void* intraVerifyAnnotationItem(const CheckState* state, void* ptr) { break; } default: { - LOGE("Bogus annotation visibility: %#x", *data); + ALOGE("Bogus annotation visibility: %#x", *data); return NULL; } } @@ -2402,7 +2402,7 @@ static bool iterateSectionWithOptionalUpdate(CheckState* state, CHECK_OFFSET_RANGE(offset, newOffset); while (offset < newOffset) { if (*ptr != '\0') { - LOGE("Non-zero padding 0x%02x @ %x", *ptr, offset); + ALOGE("Non-zero padding 0x%02x @ %x", *ptr, offset); return false; } ptr++; @@ -2415,12 +2415,12 @@ static bool iterateSectionWithOptionalUpdate(CheckState* state, newOffset = fileOffset(state, newPtr); if (newPtr == NULL) { - LOGE("Trouble with item %d @ offset %#x", i, offset); + ALOGE("Trouble with item %d @ offset %#x", i, offset); return false; } if (newOffset > state->fileLen) { - LOGE("Item %d @ offset %#x ends out of bounds", i, offset); + ALOGE("Item %d @ offset %#x ends out of bounds", i, offset); return false; } @@ -2458,13 +2458,13 @@ static bool checkBoundsAndIterateSection(CheckState* state, u4 offset, u4 count, u4 expectedOffset, u4 expectedCount, ItemVisitorFunction* func, u4 alignment, u4* nextOffset) { if (offset != expectedOffset) { - LOGE("Bogus offset for section: got %#x; expected %#x", + ALOGE("Bogus offset for section: got %#x; expected %#x", offset, expectedOffset); return false; } if (count != expectedCount) { - LOGE("Bogus size for section: got %#x; expected %#x", + ALOGE("Bogus size for section: got %#x; expected %#x", count, expectedCount); return false; } @@ -2484,7 +2484,7 @@ static bool iterateDataSection(CheckState* state, u4 offset, u4 count, assert(nextOffset != NULL); if ((offset < dataStart) || (offset >= dataEnd)) { - LOGE("Bogus offset for data subsection: %#x", offset); + ALOGE("Bogus offset for data subsection: %#x", offset); return false; } @@ -2494,7 +2494,7 @@ static bool iterateDataSection(CheckState* state, u4 offset, u4 count, } if (*nextOffset > dataEnd) { - LOGE("Out-of-bounds end of data subsection: %#x", *nextOffset); + ALOGE("Out-of-bounds end of data subsection: %#x", *nextOffset); return false; } @@ -2527,7 +2527,7 @@ static bool swapEverythingButHeaderAndMap(CheckState* state, const u1* ptr = (const u1*) filePointer(state, lastOffset); while (lastOffset < sectionOffset) { if (*ptr != '\0') { - LOGE("Non-zero padding 0x%02x before section start @ %x", + ALOGE("Non-zero padding 0x%02x before section start @ %x", *ptr, lastOffset); okay = false; break; @@ -2536,7 +2536,7 @@ static bool swapEverythingButHeaderAndMap(CheckState* state, lastOffset++; } } else if (lastOffset > sectionOffset) { - LOGE("Section overlap or out-of-order map: %x, %x", + ALOGE("Section overlap or out-of-order map: %x, %x", lastOffset, sectionOffset); okay = false; } @@ -2664,13 +2664,13 @@ static bool swapEverythingButHeaderAndMap(CheckState* state, break; } default: { - LOGE("Unknown map item type %04x", type); + ALOGE("Unknown map item type %04x", type); return false; } } if (!okay) { - LOGE("Swap of section type %04x failed", type); + ALOGE("Swap of section type %04x failed", type); } item++; @@ -2765,13 +2765,13 @@ static bool crossVerifyEverything(CheckState* state, DexMapList* pMap) break; } default: { - LOGE("Unknown map item type %04x", item->type); + ALOGE("Unknown map item type %04x", item->type); return false; } } if (!okay) { - LOGE("Cross-item verify of section type %04x failed", + ALOGE("Cross-item verify of section type %04x failed", item->type); } @@ -2788,7 +2788,7 @@ bool dexHasValidMagic(const DexHeader* pHeader) const u1* version = &magic[4]; if (memcmp(magic, DEX_MAGIC, 4) != 0) { - LOGE("ERROR: unrecognized magic number (%02x %02x %02x %02x)", + ALOGE("ERROR: unrecognized magic number (%02x %02x %02x %02x)", magic[0], magic[1], magic[2], magic[3]); return false; } @@ -2799,7 +2799,7 @@ bool dexHasValidMagic(const DexHeader* pHeader) * Magic was correct, but this is an unsupported older or * newer format variant. */ - LOGE("ERROR: unsupported dex version (%02x %02x %02x %02x)", + ALOGE("ERROR: unsupported dex version (%02x %02x %02x %02x)", version[0], version[1], version[2], version[3]); return false; } @@ -2836,7 +2836,7 @@ int dexSwapAndVerify(u1* addr, int len) if (okay) { int expectedLen = (int) SWAP4(pHeader->fileSize); if (len < expectedLen) { - LOGE("ERROR: Bad length: expected %d, got %d", expectedLen, len); + ALOGE("ERROR: Bad length: expected %d, got %d", expectedLen, len); okay = false; } else if (len != expectedLen) { ALOGW("WARNING: Odd length: expected %d, got %d", expectedLen, @@ -2864,7 +2864,7 @@ int dexSwapAndVerify(u1* addr, int len) storedFileSize - nonSum); if (adler != expectedChecksum) { - LOGE("ERROR: bad checksum (%08lx, expected %08x)", + ALOGE("ERROR: bad checksum (%08lx, expected %08x)", adler, expectedChecksum); okay = false; } @@ -2889,7 +2889,7 @@ int dexSwapAndVerify(u1* addr, int len) state.pHeader = pHeader; if (pHeader->headerSize < sizeof(DexHeader)) { - LOGE("ERROR: Small header size %d, struct %d", + ALOGE("ERROR: Small header size %d, struct %d", pHeader->headerSize, (int) sizeof(DexHeader)); okay = false; } else if (pHeader->headerSize > sizeof(DexHeader)) { @@ -2916,13 +2916,13 @@ int dexSwapAndVerify(u1* addr, int len) okay = okay && crossVerifyEverything(&state, pDexMap); } else { - LOGE("ERROR: No map found; impossible to byte-swap and verify"); + ALOGE("ERROR: No map found; impossible to byte-swap and verify"); okay = false; } } if (!okay) { - LOGE("ERROR: Byte swap + verify failed"); + ALOGE("ERROR: Byte swap + verify failed"); } if (state.pDataMap != NULL) { @@ -2952,7 +2952,7 @@ int dexSwapAndVerifyIfNecessary(u1* addr, int len) return dexSwapAndVerify(addr, len); } - LOGE("ERROR: Bad magic number (0x%02x %02x %02x %02x)", + ALOGE("ERROR: Bad magic number (0x%02x %02x %02x %02x)", addr[0], addr[1], addr[2], addr[3]); return 1; |