mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-17 18:11:56 +00:00
Issue #1244 Remove unknown actions when deobfuscation is enabled
This commit is contained in:
@@ -22,7 +22,6 @@ import com.jpexs.decompiler.flash.action.deobfuscation.ActionDeobfuscator;
|
||||
import com.jpexs.decompiler.flash.action.model.ConstantPool;
|
||||
import com.jpexs.decompiler.flash.action.special.ActionDeobfuscateJump;
|
||||
import com.jpexs.decompiler.flash.action.special.ActionEnd;
|
||||
import com.jpexs.decompiler.flash.action.special.ActionNop;
|
||||
import com.jpexs.decompiler.flash.action.special.ActionStore;
|
||||
import com.jpexs.decompiler.flash.action.special.ActionUnknown;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionIf;
|
||||
@@ -821,17 +820,6 @@ public class ActionListReader {
|
||||
|
||||
int actionLengthWithHeader = a.getTotalActionLength();
|
||||
|
||||
// unknown action, replace with jump
|
||||
if (a instanceof ActionNop) {
|
||||
ActionJump aJump = new ActionDeobfuscateJump(0);
|
||||
int jumpLength = aJump.getTotalActionLength();
|
||||
aJump.setAddress(a.getAddress());
|
||||
//FIXME! This offset can be larger than SI16 value!
|
||||
aJump.setJumpOffset(actionLengthWithHeader - jumpLength);
|
||||
a = aJump;
|
||||
actionLengthWithHeader = a.getTotalActionLength();
|
||||
}
|
||||
|
||||
Action existingAction = actionMap.get(ip);
|
||||
if (existingAction != null) {
|
||||
break;
|
||||
|
||||
@@ -101,6 +101,7 @@ public class ActionDeobfuscator extends SWFDecompilerAdapter {
|
||||
@Override
|
||||
public void actionListParsed(ActionList actions, SWF swf) throws InterruptedException {
|
||||
FastActionList fastActions = new FastActionList(actions);
|
||||
fastActions.removeUnknownActions();
|
||||
fastActions.expandPushes();
|
||||
Map<String, Object> fakeFunctions = getFakeFunctionResults(fastActions);
|
||||
boolean changed = true;
|
||||
@@ -466,9 +467,9 @@ public class ActionDeobfuscator extends SWFDecompilerAdapter {
|
||||
Action action = item.action;
|
||||
|
||||
/*System.out.print(action.getASMSource(actions, new ArrayList<Long>(), ScriptExportMode.PCODE));
|
||||
for (int j = 0; j < stack.size(); j++) {
|
||||
for (int j = 0; j < stack.size(); j++) {
|
||||
System.out.print(" '" + stack.get(j).getResult() + "'");
|
||||
}
|
||||
}
|
||||
System.out.println();*/
|
||||
if (action instanceof ActionConstantPool) {
|
||||
lastConstantPool = (ActionConstantPool) action;
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action.fastactionlist;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionList;
|
||||
import com.jpexs.decompiler.flash.action.special.ActionStore;
|
||||
import com.jpexs.decompiler.flash.action.special.ActionUnknown;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionIf;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionJump;
|
||||
import com.jpexs.decompiler.flash.action.swf4.ActionPush;
|
||||
@@ -402,6 +403,23 @@ public class FastActionList implements Collection<ActionItem> {
|
||||
} while (item != firstItem);
|
||||
}
|
||||
|
||||
public void removeUnknownActions() {
|
||||
ActionItem item = firstItem;
|
||||
if (item == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
do {
|
||||
Action action = item.action;
|
||||
if (action instanceof ActionUnknown) {
|
||||
item = removeItem(item);
|
||||
continue;
|
||||
}
|
||||
|
||||
item = item.next;
|
||||
} while (item != firstItem);
|
||||
}
|
||||
|
||||
public void removeZeroJumps() {
|
||||
ActionItem item = firstItem;
|
||||
if (item == null) {
|
||||
|
||||
Reference in New Issue
Block a user