diff options
author | Elliott Hughes <enh@google.com> | 2012-08-06 09:51:21 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2012-08-06 09:51:21 -0700 |
commit | 35ecedd8eacfd38b833135170a38221b54476c86 (patch) | |
tree | a3e9ff7f1021f8f862f46b217e5c14480fe96162 /dexdump | |
parent | 8fb8c4de25c5c95019a06b37f17bb6d82b41f4ac (diff) | |
download | android_dalvik-35ecedd8eacfd38b833135170a38221b54476c86.tar.gz android_dalvik-35ecedd8eacfd38b833135170a38221b54476c86.tar.bz2 android_dalvik-35ecedd8eacfd38b833135170a38221b54476c86.zip |
Don't crash on invalid string/type ids.
Bug: http://code.google.com/p/android/issues/detail?id=35934
Change-Id: I7bf31f6c80c794beb3554ad2f60ed5ebbca0c65e
Diffstat (limited to 'dexdump')
-rw-r--r-- | dexdump/DexDump.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/dexdump/DexDump.cpp b/dexdump/DexDump.cpp index 31fd1f8da..6ecf67168 100644 --- a/dexdump/DexDump.cpp +++ b/dexdump/DexDump.cpp @@ -764,12 +764,21 @@ static char* indexString(DexFile* pDexFile, width, index); break; case kIndexTypeRef: - outSize = snprintf(buf, bufSize, "%s // type@%0*x", - getClassDescriptor(pDexFile, index), width, index); + if (index < pDexFile->pHeader->typeIdsSize) { + outSize = snprintf(buf, bufSize, "%s // type@%0*x", + getClassDescriptor(pDexFile, index), width, index); + } else { + outSize = snprintf(buf, bufSize, "<type?> // type@%0*x", width, index); + } break; case kIndexStringRef: - outSize = snprintf(buf, bufSize, "\"%s\" // string@%0*x", - dexStringById(pDexFile, index), width, index); + if (index < pDexFile->pHeader->stringIdsSize) { + outSize = snprintf(buf, bufSize, "\"%s\" // string@%0*x", + dexStringById(pDexFile, index), width, index); + } else { + outSize = snprintf(buf, bufSize, "<string?> // string@%0*x", + width, index); + } break; case kIndexMethodRef: { |