diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java index 6a59024d8..46c7741c3 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -1829,6 +1829,19 @@ public final class SWF implements SWFContainerItem, Timelined { getVariables(variables, actionsMap, functions, strings, usageTypes, asm, path); } + public boolean as3StringConstantExists(String str) { + for (ABCContainerTag abcTag : getAbcList()) { + ABC abc = abcTag.getABC(); + for (int i = 1; i < abc.constants.getStringCount(); i++) { + if (abc.constants.getString(i).equals(str)) { + return true; + } + } + } + + return false; + } + public void fixAS3Code() { for (ABCContainerTag abcTag : getAbcList()) { ABC abc = abcTag.getABC(); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java index 81a82284e..0e5d67881 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java @@ -837,7 +837,7 @@ public class ABC { private AVM2Deobfuscation getDeobfuscation() { if (deobfuscation == null) { - deobfuscation = new AVM2Deobfuscation(constants); + deobfuscation = new AVM2Deobfuscation(getSwf(), constants); } return deobfuscation; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Deobfuscation.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Deobfuscation.java index 69b9a9bf9..820139532 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Deobfuscation.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Deobfuscation.java @@ -16,6 +16,7 @@ */ package com.jpexs.decompiler.flash.abc.avm2; +import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.abc.RenameType; import com.jpexs.decompiler.graph.DottedChain; import java.util.ArrayList; @@ -53,6 +54,8 @@ public class AVM2Deobfuscation { public static final String FOO_JOIN_CHARACTERS = "aeiouy"; + private final SWF swf; + private final AVM2ConstantPool constants; private final Map usageTypesCount = new HashMap<>(); @@ -61,7 +64,8 @@ public class AVM2Deobfuscation { public static final DottedChain BUILTIN = new DottedChain("-"); - public AVM2Deobfuscation(AVM2ConstantPool constants) { + public AVM2Deobfuscation(SWF swf, AVM2ConstantPool constants) { + this.swf = swf; this.constants = constants; } @@ -148,12 +152,11 @@ public class AVM2Deobfuscation { ret = sb.toString(); } - for (int i = 1; i < constants.getStringCount(); i++) { - if (constants.getString(i).equals(ret)) { - exists = true; - rndSize += 1; - continue loopfoo; - } + if (swf.as3StringConstantExists(ret)) { + exists = true; + rndSize += 1; + continue loopfoo; + } if (isReserved(ret)) { exists = true;