Commit e039a5a9 authored by Skylot's avatar Skylot

core: don't process debug info if offset is incorrect (#259)

parent 412a185f
...@@ -190,6 +190,10 @@ public class DexNode implements IDexNode { ...@@ -190,6 +190,10 @@ public class DexNode implements IDexNode {
return dexBuf.open(offset); return dexBuf.open(offset);
} }
public boolean checkOffset(int dataOffset) {
return dataOffset >= 0 && dataOffset < dexBuf.getLength();
}
@Override @Override
public RootNode root() { public RootNode root() {
return root; return root;
...@@ -208,4 +212,5 @@ public class DexNode implements IDexNode { ...@@ -208,4 +212,5 @@ public class DexNode implements IDexNode {
public String toString() { public String toString() {
return "DEX"; return "DEX";
} }
} }
...@@ -22,7 +22,7 @@ public class DebugInfoVisitor extends AbstractVisitor { ...@@ -22,7 +22,7 @@ public class DebugInfoVisitor extends AbstractVisitor {
public void visit(MethodNode mth) throws JadxException { public void visit(MethodNode mth) throws JadxException {
try { try {
int debugOffset = mth.getDebugInfoOffset(); int debugOffset = mth.getDebugInfoOffset();
if (debugOffset > 0) { if (debugOffset > 0 && mth.dex().checkOffset(debugOffset)) {
processDebugInfo(mth, debugOffset); processDebugInfo(mth, debugOffset);
} }
} catch (Exception e) { } catch (Exception e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment