2497 Swap instruction handling. WIP

This commit is contained in:
Jindra Petřík
2025-07-31 19:34:24 +02:00
parent 14dc0f9e08
commit b3a693e4e3
55 changed files with 366 additions and 36 deletions

View File

@@ -341,13 +341,24 @@ public class ActionScript3AssembledDecompileTest extends ActionScript3DecompileT
@Test
public void testPushWhile() {
decompileMethod("assembled", "testPushWhile", "var _loc3_:int = 5;\r\n"
+ "§§push(obfuscated[\"xxx\"] = new (getDefinitionByName(\"flash.utils\"+\".\"+\"ByteArray\"))());\r\n"
+ "§§push(new (getDefinitionByName(\"flash.utils\"+\".\"+\"ByteArray\"))());\r\n"
+ "§§push(§§dup(new (getDefinitionByName(\"flash.utils\"+\".\"+\"ByteArray\"))()));\r\n"
+ "§§push(obfuscated);\r\n"
+ "§§swap();\r\n"
+ "§§pop()[\"xxx\"] = §§pop();\r\n"
+ "§§push(50);\r\n"
+ "while(§§dup(§§pop()))\r\n"
+ "{\r\n"
+ "§§dup(§§pop())[§§dup(§§dup(§§pop())).length] = 0x29 ^ 0x6F;\r\n"
+ "§§dup(§§pop())[§§dup(§§dup(§§pop())).length] = 9 ^ 0x54;\r\n"
+ "§§push(§§pop());\r\n"
+ "§§push(§§pop() - 1);\r\n"
+ "§§swap();\r\n"
+ "§§push(§§pop());\r\n"
+ "§§dup(§§pop())[§§dup(§§dup(§§pop())).length] = 0x29 ^ 0x6F;\r\n"
+ "§§push(§§pop());\r\n"
+ "§§dup(§§pop())[§§dup(§§dup(§§pop())).length] = 9 ^ 0x54;\r\n"
+ "§§push(§§pop());\r\n"
+ "§§push(§§pop());\r\n"
+ "§§swap();\r\n"
+ "}\r\n"
+ "§§pop();\r\n"
+ "§§pop();\r\n",

View File

@@ -713,14 +713,16 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript
+ "var _loc1_:int = 5;\r\n"
+ "if(_loc1_ > 4)\r\n"
+ "{\r\n"
+ "§§push(\"RET\");\r\n"
+ "trace(\"in finally\");\r\n"
+ "return \"RET\";\r\n"
+ "return §§pop();\r\n"
+ "}\r\n"
+ "trace(\"between\");\r\n"
+ "if(_loc1_ < 3)\r\n"
+ "{\r\n"
+ "§§push(\"RE2\");\r\n"
+ "trace(\"in finally\");\r\n"
+ "return \"RE2\";\r\n"
+ "return §§pop();\r\n"
+ "}\r\n"
+ "trace(\"in try2\");\r\n"
+ "}\r\n"
@@ -788,9 +790,10 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript
+ "trace(\"in try2\");\r\n"
+ "if(_loc1_ > 4)\r\n"
+ "{\r\n"
+ "§§push(\"RET\");\r\n"
+ "trace(\"in finally2\");\r\n"
+ "trace(\"in finally1\");\r\n"
+ "return \"RET\";\r\n"
+ "return §§pop();\r\n"
+ "}\r\n"
+ "}\r\n"
+ "catch(e:Error)\r\n"
@@ -832,10 +835,11 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript
+ "trace(\"in try2\");\r\n"
+ "if(_loc1_ > 4)\r\n"
+ "{\r\n"
+ "§§push(\"RET\");\r\n"
+ "trace(\"in finally2\");\r\n"
+ "trace(\"in finally1\");\r\n"
+ "trace(\"in finally0\");\r\n"
+ "return \"RET\";\r\n"
+ "return §§pop();\r\n"
+ "}\r\n"
+ "}\r\n"
+ "catch(e2:Error)\r\n"