From b6034cfa16a5b061bfc08ed506b5566e063fd5f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=F8=EDk?= Date: Sat, 27 Jul 2013 16:18:46 +0200 Subject: [PATCH] Issue #266 AS3 deobfuscation fix --- .../com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java index bd761e3df..1149f5435 100644 --- a/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java +++ b/trunk/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java @@ -82,7 +82,7 @@ import java.util.logging.Logger; public class AVM2Code implements Serializable { public static final long serialVersionUID = 1L; - private static final boolean DEBUG_MODE = false; + private static final boolean DEBUG_MODE = true; public static int toSourceLimit = -1; public ArrayList code = new ArrayList<>(); public static boolean DEBUG_REWRITE = false; @@ -2105,6 +2105,9 @@ public class AVM2Code implements Serializable { } private static boolean isDirectAncestor(int currentIp, int ancestor, HashMap> refs, List visited) { + if (currentIp == -1) { + return true; + } do { if (currentIp == ancestor) { return true; @@ -2163,7 +2166,7 @@ public class AVM2Code implements Serializable { @SuppressWarnings("unchecked") private static int removeTraps(HashMap> refs, boolean secondPass, boolean useVisited, List localData, Stack stack, List output, AVM2GraphSource code, int ip, HashMap visited, HashMap> visitedStates, HashMap decisions, String path) { - boolean debugMode = false; + boolean debugMode = true; int ret = 0; iploop: while ((ip > -1) && ip < code.size()) { @@ -2221,6 +2224,9 @@ public class AVM2Code implements Serializable { ip++; continue; } + if (ip == 131) { + System.err.println("debug"); + } if (debugMode) { System.out.println((useVisited ? "useV " : "") + (secondPass ? "secondPass " : "") + "Visit " + ip + ": " + ins + " stack:" + Highlighting.stripHilights(stack.toString())); }