Fixed #2077 AS3 try..catch parts outside block

Fixed AS3 try..catch inside loop unneccessary continue
This commit is contained in:
Jindra Petřík
2023-09-23 12:10:26 +02:00
parent 97d04cbedd
commit b08856d3a5
16 changed files with 248 additions and 30 deletions

View File

@@ -64,6 +64,7 @@ public class ActionScript3DeobfuscatorTest extends ActionScriptTestBase {
Configuration.decompilationTimeoutSingleMethod.set(Integer.MAX_VALUE);
Configuration.padAs3PCodeInstructionName.set(false);
Configuration.useOldStyleGetSetLocalsAs3PCode.set(false);
Configuration.labelOnSeparateLineAs3PCode.set(true);
swf = new SWF(new BufferedInputStream(new FileInputStream("testdata/as3/as3.swf")), false);
}

View File

@@ -1899,8 +1899,8 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
+ "}\r\n"
+ "catch(e:Error)\r\n"
+ "{\r\n"
+ "return 4;\r\n"
+ "}\r\n",
+ "}\r\n"
+ "return 4;\r\n",
false);
}
@@ -2138,11 +2138,9 @@ public class ActionScript3ClassicAirDecompileTest extends ActionScript3Decompile
+ "}\r\n"
+ "catch(e:EOFError)\r\n"
+ "{\r\n"
+ "continue;\r\n"
+ "}\r\n"
+ "catch(e:Error)\r\n"
+ "{\r\n"
+ "continue;\r\n"
+ "}\r\n"
+ "}\r\n",
false);

View File

@@ -1883,8 +1883,8 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
+ "}\r\n"
+ "catch(e:Error)\r\n"
+ "{\r\n"
+ "return 4;\r\n"
+ "}\r\n",
+ "}\r\n"
+ "return 4;\r\n",
false);
}
@@ -2128,11 +2128,9 @@ public class ActionScript3ClassicDecompileTest extends ActionScript3DecompileTes
+ "}\r\n"
+ "catch(e:EOFError)\r\n"
+ "{\r\n"
+ "continue;\r\n"
+ "}\r\n"
+ "catch(e:Error)\r\n"
+ "{\r\n"
+ "continue;\r\n"
+ "}\r\n"
+ "}\r\n",
false);

View File

@@ -155,11 +155,9 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi
+ "}\r\n"
+ "catch(e:EOFError)\r\n"
+ "{\r\n"
+ "continue;\r\n"
+ "}\r\n"
+ "catch(e:Error)\r\n"
+ "{\r\n"
+ "continue;\r\n"
+ "}\r\n"
+ "}\r\n",
false);
@@ -216,8 +214,8 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi
+ "catch(e:Error)\r\n"
+ "{\r\n"
+ "trace(\"in catch\");\r\n"
+ "a++;\r\n"
+ "}\r\n"
+ "a++;\r\n"
+ "}\r\n"
+ "return \"OK\";\r\n",
false);
@@ -242,8 +240,8 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi
+ "catch(e:Error)\r\n"
+ "{\r\n"
+ "trace(\"in catch2\");\r\n"
+ "trace(\"a=\" + a);\r\n"
+ "}\r\n"
+ "trace(\"a=\" + a);\r\n"
+ "}\r\n"
+ "trace(\"after\");\r\n",
false);
@@ -342,8 +340,8 @@ public class ActionScript3CrossCompileDecompileTest extends ActionScript3Decompi
+ "catch(e:Error)\r\n"
+ "{\r\n"
+ "trace(\"in catch\");\r\n"
+ "trace(\"a=\" + a);\r\n"
+ "}\r\n"
+ "trace(\"a=\" + a);\r\n"
+ "}\r\n"
+ "trace(\"after\");\r\n",
false);

View File

@@ -146,11 +146,9 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript
+ "}\r\n"
+ "catch(e:EOFError)\r\n"
+ "{\r\n"
+ "continue;\r\n"
+ "}\r\n"
+ "catch(e:Error)\r\n"
+ "{\r\n"
+ "continue;\r\n"
+ "}\r\n"
+ "}\r\n",
false);
@@ -246,7 +244,7 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript
+ "_loc1_ = 0;\r\n"
+ "var _loc2_:int = 0;\r\n"
+ "_loc2_ = 5;\r\n"
+ "while(_loc1_ < 10)\r\n"
+ "for(; _loc1_ < 10; _loc1_++)\r\n"
+ "{\r\n"
+ "try\r\n"
+ "{\r\n"
@@ -260,7 +258,6 @@ public class ActionScript3CrossCompileSwfToolsDecompileTest extends ActionScript
+ "throw new Error(\"Problem: \" + _loc3_);\r\n"
+ "}\r\n"
+ "}\r\n"
+ "_loc1_++;\r\n"
+ "}\r\n"
+ "trace(\"after\");\r\n",
false);