mirror of
https://github.com/iBotPeaches/Apktool.git
synced 2024-12-01 00:10:31 +00:00
Handle invalid debug item offsets more gracefully
This commit is contained in:
parent
fd489e990c
commit
52fd17a436
@ -123,7 +123,16 @@ public class DexBackedMethodImplementation implements MethodImplementation {
|
||||
|
||||
@Nonnull
|
||||
private DebugInfo getDebugInfo() {
|
||||
return DebugInfo.newOrEmpty(dexFile, dexFile.readSmallUint(codeOffset + CodeItem.DEBUG_INFO_OFFSET), this);
|
||||
int debugOffset = dexFile.readInt(codeOffset + CodeItem.DEBUG_INFO_OFFSET);
|
||||
|
||||
if (debugOffset == -1 || debugOffset == 0) {
|
||||
return DebugInfo.newOrEmpty(dexFile, 0, this);
|
||||
}
|
||||
if (debugOffset < 0) {
|
||||
System.err.println("%s: Invalid debug offset");
|
||||
return DebugInfo.newOrEmpty(dexFile, 0, this);
|
||||
}
|
||||
return DebugInfo.newOrEmpty(dexFile, debugOffset, this);
|
||||
}
|
||||
|
||||
@Nonnull @Override
|
||||
|
@ -100,10 +100,10 @@ public class CodeItem {
|
||||
int triesCount = reader.readUshort();
|
||||
out.annotate(2, "tries_size = %d", triesCount);
|
||||
|
||||
int debugInfoOffset = reader.readSmallUint();
|
||||
int debugInfoOffset = reader.readInt();
|
||||
out.annotate(4, "debug_info_off = 0x%x", debugInfoOffset);
|
||||
|
||||
if (debugInfoOffset != 0) {
|
||||
if (debugInfoOffset > 0) {
|
||||
addDebugInfoIdentity(debugInfoOffset, itemIdentity);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user