AS2 deobfuscation improved / faster

This commit is contained in:
2015-10-17 09:52:21 +02:00
parent d2eaaa9fab
commit 85788e258c
8 changed files with 204 additions and 151 deletions
@@ -19,6 +19,7 @@ package com.jpexs.decompiler.graph;
import com.jpexs.decompiler.flash.BaseLocalData;
import com.jpexs.decompiler.flash.FinalProcessLocalData;
import com.jpexs.decompiler.flash.action.Action;
import com.jpexs.decompiler.flash.action.model.FunctionActionItem;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.graph.model.AndItem;
import com.jpexs.decompiler.graph.model.BreakItem;
@@ -2489,7 +2490,6 @@ public class Graph {
protected static void makeAllCommands(List<GraphTargetItem> commands, TranslateStack stack) {
int clen = commands.size();
BreakItem br = null;
if (!commands.isEmpty()) {
if (commands.get(commands.size() - 1) instanceof BreakItem) {
clen--;
@@ -2498,7 +2498,11 @@ public class Graph {
while (stack.size() > 0) {
GraphTargetItem p = stack.pop();
if (!(p instanceof PopItem)) {
commands.add(clen, new PushItem(p));
if (p instanceof FunctionActionItem) {
commands.add(clen, p);
} else {
commands.add(clen, new PushItem(p));
}
}
}
}
@@ -19,6 +19,7 @@ package com.jpexs.decompiler.graph;
import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
import com.jpexs.decompiler.flash.action.model.DirectValueActionItem;
import com.jpexs.decompiler.flash.configuration.Configuration;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
import com.jpexs.decompiler.flash.helpers.hilight.HighlightData;
@@ -381,9 +382,7 @@ public abstract class GraphTargetItem implements Serializable, Cloneable {
public long getAsLong() {
if (this instanceof DirectValueActionItem) {
DirectValueActionItem dvai = (DirectValueActionItem) this;
if (dvai.value instanceof Long) {
return (long) (Long) dvai.value;
}
return (long) (double) EcmaScript.toNumber(dvai.value);
}
return 0;