mirror of
https://github.com/revanced/Apktool.git
synced 2024-08-15 03:40:34 +02: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
|
@Nonnull
|
||||||
private DebugInfo getDebugInfo() {
|
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
|
@Nonnull @Override
|
||||||
|
@ -100,10 +100,10 @@ public class CodeItem {
|
|||||||
int triesCount = reader.readUshort();
|
int triesCount = reader.readUshort();
|
||||||
out.annotate(2, "tries_size = %d", triesCount);
|
out.annotate(2, "tries_size = %d", triesCount);
|
||||||
|
|
||||||
int debugInfoOffset = reader.readSmallUint();
|
int debugInfoOffset = reader.readInt();
|
||||||
out.annotate(4, "debug_info_off = 0x%x", debugInfoOffset);
|
out.annotate(4, "debug_info_off = 0x%x", debugInfoOffset);
|
||||||
|
|
||||||
if (debugInfoOffset != 0) {
|
if (debugInfoOffset > 0) {
|
||||||
addDebugInfoIdentity(debugInfoOffset, itemIdentity);
|
addDebugInfoIdentity(debugInfoOffset, itemIdentity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user