correctly handles abused length strings - jtmuhone

This commit is contained in:
Connor Tumbleson 2013-12-18 08:41:18 -06:00
parent 52767a2a94
commit 1d745ac0ad
2 changed files with 18 additions and 5 deletions

View File

@ -26,7 +26,8 @@ v2.0.0 (TBA)
-Fixed (issue #524) - INSTALL_FAILED_DEXOPT fix (JesusFreke)
-Fixed (issue #473) - multiple package frameworks are treated correctly.
-Fixed (issue #531) - JAR disassembling borking is fixed
-Fixed (issue #550) - Corectly labels incorrect type handling of <array>
-Fixed (issue #550) - Correctly labels incorrect type handling of <array>
-Fixed (issue #571) - Fixed truncated strings (Thanks jtmuhone)
-Added output to list Apktool version to help debugging.
-Updated known bytes for configurations to 38 (from addition of layout direction)
-Fixed NPE when handling odex apks even with --no-src specified. (Thanks Rodrigo Chiossi)

View File

@ -102,10 +102,22 @@ public class StringBlock {
length = getShort(m_strings, offset) * 2;
offset += 2;
} else {
offset += getVarint(m_strings, offset)[1];
int[] varint = getVarint(m_strings, offset);
offset += varint[1];
length = varint[0];
int val = m_strings[offset];
if ((val & 0x80) != 0) {
offset += 2;
} else {
offset += 1;
}
val = m_strings[offset];
if ((val & 0x80) != 0) {
offset += 2;
} else {
offset += 1;
}
length = 0;
while (m_strings[offset + length] != 0) {
length++;
}
}
return decodeString(offset, length);
}