diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java index 516769410..3272efa80 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java @@ -1956,7 +1956,7 @@ public class AVM2Code implements Cloneable { }, body); } - private void checkValidOffsets(MethodBody body) { + public void checkValidOffsets(MethodBody body) { updateOffsets(new OffsetUpdater() { @Override @@ -1978,14 +1978,15 @@ public class AVM2Code implements Cloneable { if ((pos < 0) || (pos >= code.size())) { throw new IndexOutOfBoundsException(); } - checkValidOffsets(body); + + //checkValidOffsets(body); AVM2Instruction ins = code.get(pos); final long remOffset = ins.offset; int bc; if (pos < code.size() - 1) { // Checking the instuction length is not enough because in some // obfuscated files the length of the lookupswitch is not the same - // as the diference of the offsets + // as the difference of the offsets bc = (int) (code.get(pos + 1).offset - remOffset); } else { bc = ins.getBytesLength(); @@ -2014,9 +2015,7 @@ public class AVM2Code implements Cloneable { }, body); code.remove(pos); invalidateCache(); - checkValidOffsets(body); - //System.exit(0); - + //checkValidOffsets(body); } /** diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java index e58f49029..7f9046fad 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java @@ -332,24 +332,27 @@ public final class MethodBody implements Cloneable { } public MethodBody convertMethodBody(String path, boolean isStatic, int scriptIndex, int classIndex, ABC abc, Trait trait, AVM2ConstantPool constants, List method_info, ScopeStack scopeStack, boolean isStaticInitializer, List fullyQualifiedNames, Traits initTraits) throws InterruptedException { - MethodBody b = clone(); - b.getCode().markMappedOffsets(); + MethodBody body = clone(); + body.getCode().markMappedOffsets(); if (Configuration.autoDeobfuscate.get()) { if (Configuration.deobfuscationOldMode.get()) { try { - b.getCode().removeTraps(constants, trait, method_info.get(this.method_info), b, abc, scriptIndex, classIndex, isStatic, path); + body.getCode().removeTraps(constants, trait, method_info.get(this.method_info), body, abc, scriptIndex, classIndex, isStatic, path); } catch (Throwable ex) { logger.log(Level.SEVERE, "Error during old deobfuscation: " + path, ex); } } else { - new AVM2DeobfuscatorSimple().deobfuscate(path, classIndex, isStatic, scriptIndex, abc, constants, trait, method_info.get(this.method_info), b); - new AVM2DeobfuscatorRegisters().deobfuscate(path, classIndex, isStatic, scriptIndex, abc, constants, trait, method_info.get(this.method_info), b); - new AVM2DeobfuscatorJumps().deobfuscate(path, classIndex, isStatic, scriptIndex, abc, constants, trait, method_info.get(this.method_info), b); + new AVM2DeobfuscatorSimple().deobfuscate(path, classIndex, isStatic, scriptIndex, abc, constants, trait, method_info.get(this.method_info), body); + new AVM2DeobfuscatorRegisters().deobfuscate(path, classIndex, isStatic, scriptIndex, abc, constants, trait, method_info.get(this.method_info), body); + new AVM2DeobfuscatorJumps().deobfuscate(path, classIndex, isStatic, scriptIndex, abc, constants, trait, method_info.get(this.method_info), body); } + + // todo: only for debugging. checkValidOffsets can be made private later + body.getCode().checkValidOffsets(body); } - return b; + return body; } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java b/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java index b7394f026..576718302 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java +++ b/libsrc/ffdec_lib/src/com/jpexs/helpers/Helper.java @@ -1053,7 +1053,7 @@ public class Helper { writer.appendNoHilight(" * ").appendNoHilight(AppResources.translate("decompilationError")).newLine(); writer.appendNoHilight(" * ").appendNoHilight(MessageFormat.format(AppResources.translate("decompilationError.timeout"), Helper.formatTimeToText(timeout))).newLine(); if (actionCount > 0) { - writer.appendNoHilight(" * ").appendNoHilight(AppResources.translate("decompilationError.instructionCount") + " " + actionCount).newLine(); + writer.appendNoHilight(" * ").appendNoHilight(AppResources.translate("decompilationError.actionCount") + " " + actionCount).newLine(); } writer.appendNoHilight(" */").newLine(); @@ -1067,7 +1067,7 @@ public class Helper { writer.appendNoHilight(" * ").appendNoHilight(AppResources.translate("decompilationError")).newLine(); writer.appendNoHilight(" * ").appendNoHilight(MessageFormat.format(AppResources.translate("decompilationError.timeout"), Helper.formatTimeToText(timeout))).newLine(); if (instructionCount > 0) { - writer.appendNoHilight(" * ").appendNoHilight(AppResources.translate("decompilationError.actionCount") + " " + instructionCount).newLine(); + writer.appendNoHilight(" * ").appendNoHilight(AppResources.translate("decompilationError.instructionCount") + " " + instructionCount).newLine(); } writer.appendNoHilight(" */").newLine();