mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-20 14:05:37 +00:00
AS2 deobfuscation: some more EmptyStack problem fixed
This commit is contained in:
@@ -49,6 +49,7 @@ public class ActionNextFrame extends Action {
|
||||
if (f < ((DisplayObject) lda.target).getTotalFrames()) {
|
||||
((DisplayObject) lda.target).gotoFrame(f + 1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ public class ActionPrevFrame extends Action {
|
||||
if (f > 1) {
|
||||
((DisplayObject) lda.target).gotoFrame(f - 1);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ public class ActionSetTarget extends Action {
|
||||
lda.target = lda.stage;
|
||||
return true;
|
||||
}
|
||||
|
||||
lda.target = lda.stage.getMember(targetName);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionAsciiToChar extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ActionCall extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionCharToAscii extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ public class ActionCloneSprite extends Action {
|
||||
if (lda.stack.size() < 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int depth = EcmaScript.toInt32(lda.stack.pop());
|
||||
String source = EcmaScript.toString(lda.stack.pop());
|
||||
String target = EcmaScript.toString(lda.stack.pop());
|
||||
|
||||
@@ -48,6 +48,7 @@ public class ActionEndDrag extends Action {
|
||||
if (lda.target instanceof DisplayObject) {
|
||||
((DisplayObject) lda.target).stopDrag();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ public class ActionGetProperty extends Action {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int index = EcmaScript.toInt32(lda.stack.pop());
|
||||
String target = EcmaScript.toString(lda.stack.pop());
|
||||
Object movieClip = lda.stage.getMember(target);
|
||||
|
||||
@@ -116,6 +116,7 @@ public class ActionGetURL2 extends Action {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String target = EcmaScript.toString(lda.stack.pop());
|
||||
String urlString = EcmaScript.toString(lda.stack.pop());
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ActionGetVariable extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,9 +109,10 @@ public class ActionGotoFrame2 extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() < 1) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String frame = EcmaScript.toString(lda.stack.pop());
|
||||
String target = "/";
|
||||
if (frame.contains(":")) {
|
||||
|
||||
@@ -110,7 +110,7 @@ public class ActionIf extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionMBAsciiToChar extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionMBCharToAscii extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionMBStringLength extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionNot extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ public class ActionPop extends Action {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
lda.stack.pop();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -45,9 +45,10 @@ public class ActionRandomNumber extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() < 1) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
lda.stack.push(RandomNumberActionItem.getResult(lda.pop()));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ public class ActionRemoveSprite extends Action {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String target = EcmaScript.toString(lda.stack.pop());
|
||||
lda.stage.removeMember(target);
|
||||
return true;
|
||||
|
||||
@@ -59,6 +59,7 @@ public class ActionSetProperty extends Action {
|
||||
if (lda.stack.size() < 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object value = lda.pop();
|
||||
int index = (int) (double) lda.popAsNumber();
|
||||
String target = lda.popAsString();
|
||||
|
||||
@@ -48,6 +48,7 @@ public class ActionSetTarget2 extends Action {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String target = lda.popAsString();
|
||||
lda.target = lda.stage.getMember(target);
|
||||
return true;
|
||||
|
||||
@@ -50,6 +50,7 @@ public class ActionStartDrag extends Action {
|
||||
if (lda.target instanceof DisplayObject) {
|
||||
((DisplayObject) lda.target).startDrag();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionStringLength extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionToInteger extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ public class ActionTrace extends Action {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
lda.stage.trace(lda.pop());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -49,19 +49,20 @@ public class ActionCallFunction extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
|
||||
String functionName = lda.popAsString();
|
||||
int numArgs = (int) (double) lda.popAsNumber();
|
||||
List<Object> args = new ArrayList<>();
|
||||
for (int i = 0; i < numArgs; i++) {
|
||||
args.add(lda.pop());
|
||||
}
|
||||
|
||||
for (ActionScriptFunction f : lda.functions) {
|
||||
if (functionName.equals(f.getFunctionName())) {
|
||||
lda.stack.push(lda.stage.callFunction(f.getFunctionOffset(), f.getFunctionLength(), args, f.getFuncRegNames(), Undefined.INSTANCE /*?*/));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ public class ActionCallMethod extends Action {
|
||||
if (lda.stack.size() < 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String methodName = lda.popAsString();
|
||||
Object obj0 = lda.pop();
|
||||
if (!(obj0 instanceof ActionScriptObject)) {
|
||||
@@ -62,6 +63,7 @@ public class ActionCallMethod extends Action {
|
||||
if (lda.stack.size() < numArgs) {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<Object> args = new ArrayList<>();
|
||||
for (int i = 0; i < numArgs; i++) {
|
||||
args.add(lda.pop());
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionDecrement extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,11 +47,16 @@ public class ActionDelete2 extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String memberName = lda.popAsString();
|
||||
Object o = lda.target; //should be current scope
|
||||
if (o instanceof ActionScriptObject) {
|
||||
((ActionScriptObject) o).setMember(memberName, Undefined.INSTANCE);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ public class ActionEnumerate extends Action {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String objectName = lda.popAsString();
|
||||
lda.stack.push(Null.INSTANCE);
|
||||
|
||||
|
||||
@@ -50,6 +50,7 @@ public class ActionGetMember extends Action {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String membername = lda.popAsString();
|
||||
Object obj = lda.pop();
|
||||
if (obj instanceof ActionScriptObject) {
|
||||
@@ -57,6 +58,7 @@ public class ActionGetMember extends Action {
|
||||
} else {
|
||||
lda.stack.push(Undefined.INSTANCE);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionIncrement extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,14 +45,17 @@ public class ActionInitArray extends Action {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int num = (int) (double) lda.popAsNumber();
|
||||
if (lda.stack.size() < num) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ActionScriptArray arr = new ActionScriptArray();
|
||||
for (int i = 0; i < num; i++) {
|
||||
arr.setValueAtIndex(i, lda.stack.pop());
|
||||
}
|
||||
|
||||
lda.stack.push(arr);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -50,16 +50,19 @@ public class ActionInitObject extends Action {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int num = (int) (double) (Double) lda.popAsNumber();
|
||||
if (lda.stack.size() < 2 * num) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ActionScriptObject obj = new ActionScriptObject();
|
||||
for (int i = 0; i < num; i++) {
|
||||
Object val = lda.pop();
|
||||
String name = lda.popAsString();
|
||||
obj.setMember(name, val);
|
||||
}
|
||||
|
||||
lda.stack.push(obj);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -51,16 +51,19 @@ public class ActionNewMethod extends Action {
|
||||
if (lda.stack.size() < 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String methodName = lda.popAsString();
|
||||
ActionScriptObject obj = (ActionScriptObject) lda.pop();
|
||||
int numArgs = (int) (double) lda.popAsNumber();
|
||||
if (lda.stack.size() < numArgs) {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<Object> args = new ArrayList<>();
|
||||
for (int i = 0; i < numArgs; i++) {
|
||||
args.add(lda.pop());
|
||||
}
|
||||
|
||||
ActionScriptObject nobj = new ActionScriptObject();
|
||||
ActionScriptFunction f = (ActionScriptFunction) obj.getMember(methodName);
|
||||
lda.stage.callFunction(f.getFunctionOffset(), f.getFunctionLength(), args, f.getFuncRegNames(), nobj);
|
||||
|
||||
@@ -18,7 +18,6 @@ package com.jpexs.decompiler.flash.action.swf5;
|
||||
|
||||
import com.jpexs.decompiler.flash.BaseLocalData;
|
||||
import com.jpexs.decompiler.flash.action.Action;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptFunction;
|
||||
import com.jpexs.decompiler.flash.action.ActionScriptObject;
|
||||
import com.jpexs.decompiler.flash.action.LocalDataArea;
|
||||
import com.jpexs.decompiler.flash.action.model.NewObjectActionItem;
|
||||
@@ -51,19 +50,22 @@ public class ActionNewObject extends Action {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String objectName = lda.popAsString();
|
||||
int numArgs = (int) (double) (Double) lda.popAsNumber();
|
||||
if (lda.stack.size() < numArgs) {
|
||||
return false;
|
||||
}
|
||||
|
||||
List<Object> args = new ArrayList<>();
|
||||
for (int i = 0; i < numArgs; i++) {
|
||||
args.add(lda.stack.pop());
|
||||
}
|
||||
|
||||
ActionScriptObject obj = new ActionScriptObject();
|
||||
//TODO:check type
|
||||
//TODO:check type
|
||||
/*ActionScriptFunction constructor = (ActionScriptFunction) lda.stage.getMember(objectName);
|
||||
lda.stage.callFunction(constructor.getFunctionOffset(), constructor.getFunctionLength(), args, constructor.getFuncRegNames(), obj);
|
||||
lda.stage.callFunction(constructor.getFunctionOffset(), constructor.getFunctionLength(), args, constructor.getFuncRegNames(), obj);
|
||||
*/
|
||||
lda.stack.push(obj);
|
||||
return true;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class ActionPushDuplicate extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionReturn extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
//lda.returnValue = Undefined.INSTANCE;
|
||||
return false;
|
||||
} else {
|
||||
|
||||
@@ -58,12 +58,14 @@ public class ActionSetMember extends Action {
|
||||
if (lda.stack.size() < 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object value = lda.pop();
|
||||
String memberName = lda.popAsString();
|
||||
Object obj = lda.pop();
|
||||
if (obj instanceof ActionScriptObject) {
|
||||
((ActionScriptObject) obj).setMember(memberName, value);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ public class ActionTargetPath extends Action {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object obj = lda.pop();
|
||||
|
||||
String path = lda.stage.getMemberPath(obj);
|
||||
@@ -57,6 +58,7 @@ public class ActionTargetPath extends Action {
|
||||
} else {
|
||||
lda.stack.push(path);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionToNumber extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionToString extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ActionTypeOf extends Action {
|
||||
|
||||
@Override
|
||||
public boolean execute(LocalDataArea lda) {
|
||||
if (lda.stack.size() == 0) {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ public class ActionWith extends Action implements GraphSourceItemContainer {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ActionScriptObject obj = (ActionScriptObject) lda.pop();
|
||||
ActionScriptWith w = new ActionScriptWith(obj, fileOffset, codeSize);
|
||||
lda.withs.add(w);
|
||||
|
||||
@@ -61,6 +61,7 @@ public class ActionEnumerate2 extends Action {
|
||||
if (lda.stack.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object o = lda.pop();
|
||||
lda.stack.push(Null.INSTANCE);
|
||||
|
||||
@@ -70,6 +71,7 @@ public class ActionEnumerate2 extends Action {
|
||||
lda.stack.push(m);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,6 +72,7 @@ public class ActionInstanceOf extends Action {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Object type = lda.stack.pop();
|
||||
Object obj = lda.stack.pop();
|
||||
if (getInstanceOfResult(obj, type)) {
|
||||
|
||||
@@ -51,6 +51,7 @@ public class ActionCastOp extends Action {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ActionScriptObject obj = (ActionScriptObject) lda.pop();
|
||||
ActionScriptObject constr = (ActionScriptObject) lda.pop();
|
||||
if (ActionInstanceOf.getInstanceOfResult(obj, constr)) {
|
||||
@@ -58,6 +59,7 @@ public class ActionCastOp extends Action {
|
||||
} else {
|
||||
lda.stack.push(Null.INSTANCE);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ public class ActionExtends extends Action {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//TODO: check if its really ActionScriptObject ?
|
||||
ActionScriptObject superClass = (ActionScriptObject) lda.pop();
|
||||
ActionScriptObject subClass = (ActionScriptObject) lda.pop();
|
||||
|
||||
@@ -50,6 +50,7 @@ public class ActionImplementsOp extends Action {
|
||||
if (lda.stack.size() < 2) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//TODO: check if its really scriptobject?
|
||||
ActionScriptObject obj = (ActionScriptObject) lda.pop();
|
||||
int num = (int) (double) lda.popAsNumber();
|
||||
@@ -57,9 +58,11 @@ public class ActionImplementsOp extends Action {
|
||||
if (lda.stack.size() < num) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < num; i++) {
|
||||
interfaces.add(lda.stack.pop());
|
||||
}
|
||||
|
||||
obj.setImplementsObjs(interfaces);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user