better constant in action deobfuscator

This commit is contained in:
honfika@gmail.com
2015-09-24 15:01:08 +02:00
parent f9863c5a5e
commit eee92d02a4
2 changed files with 6 additions and 27 deletions

View File

@@ -180,7 +180,7 @@ public class ActionDeobfuscator extends ActionDeobfuscatorSimple {
}
}
if (allValueValid && newIstructionCount * 5 < result.instructionsProcessed) {
if (allValueValid && newIstructionCount * 2 < result.instructionsProcessed) {
Action target = actions.get(result.idx);
Action prevAction = actions.get(i);

View File

@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.SourceGeneratorLocalData;
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
import com.jpexs.decompiler.flash.action.swf4.ConstantIndex;
import com.jpexs.decompiler.flash.action.swf4.RegisterNumber;
import com.jpexs.decompiler.flash.ecma.EcmaScript;
import com.jpexs.decompiler.flash.ecma.Null;
import com.jpexs.decompiler.flash.ecma.Undefined;
import com.jpexs.decompiler.flash.helpers.GraphTextWriter;
@@ -146,39 +147,17 @@ public class DirectValueActionItem extends ActionItem implements SimpleValue {
}
public String toStringNoH(ConstantPool constants) {
if (value instanceof Double) {
if (Double.compare((double) (Double) value, 0) == 0) {
return "0";
}
}
if (value instanceof Float) {
if (Float.compare((float) (Float) value, 0) == 0) {
return "0";
}
}
if (value instanceof String) {
return (String) value;
}
if (value instanceof ConstantIndex) {
return this.constants.get(((ConstantIndex) value).index);
}
return value.toString();
return EcmaScript.toString(value);
}
@Override
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
if (value instanceof Double) {
if (Double.compare((double) (Double) value, 0) == 0) {
return writer.append("0");
}
}
if (value instanceof Float) {
if (Float.compare((float) (Float) value, 0) == 0) {
return writer.append("0");
}
}
if (value instanceof String) {
return writer.append("\"").append(Helper.escapeActionScriptString((String) value)).append("\"");
return writer.append("\"").append(Helper.escapeActionScriptString(EcmaScript.toString(value))).append("\"");
}
if (value instanceof ConstantIndex) {
return writer.append("\"").append(Helper.escapeActionScriptString(this.constants.get(((ConstantIndex) value).index))).append("\"");
@@ -186,7 +165,7 @@ public class DirectValueActionItem extends ActionItem implements SimpleValue {
if (value instanceof RegisterNumber) {
return writer.append(((RegisterNumber) value).translate());
}
return writer.append(value.toString());
return writer.append(EcmaScript.toString(value));
}
@Override