JPEXS Free Flash Decompiler Issue Tracker

If you are looking for the decompiler itself, visit https://github.com/jindrapetrik/jpexs-decompiler

NEW : We have got a new blog where we post some interesting SWF internals info.

List of issuesList of issues

#2568 Incorrect decompilation with deobfuscation enabled
Date created:
Type: bug
Visibility: Everybody
Assigned to:
State: new Help

> What steps will reproduce the problem? Compile the following method (eg. via mxmlc): ``` public static function myfunc(param1: String, param2: String): String { for (var i:int = 0; i < param1.length; i++) { if (param1[i] == param2[i]) { var ret:String = param1[i]; break; } } return ret; } ``` Decompile with `autoDeobfuscate` enabled. > What is the expected output? What do you see instead? Expected output: ``` public static function myfunc(param1:String, param2:String) : String { var _loc4_:String = null; var _loc3_:int = 0; while(_loc3_ < param1.length) { if(param1[_loc3_] == param2[_loc3_]) { _loc4_ = param1[_loc3_]; break; } _loc3_++; } return _loc4_; } ``` Actual output: ``` public static function myfunc(param1:String, param2:String) : String { var _loc3_:int = 0; while(_loc3_ < param1.length) { if(param1[_loc3_] == param2[_loc3_]) { var _loc4_:String = param1[_loc3_]; break; } _loc3_++; } return null; } ``` > What version of the product are you using? Is it "nightly build"? Which operating system do you have? Tested with ffdec 24.1.1 on Arch Linux. > Please provide any additional information below. If the problem is related to a SWF file, attach it here, otherwise we can't help you. By commenting out line 3285 in com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java, I was able to successfully decompile the method (with the expected output): ``` diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java index 959614f63..3f63b839e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java @@ -3282,7 +3282,7 @@ public class AVM2Code implements Cloneable { new AVM2DeobfuscatorSimpleOld().avm2CodeRemoveTraps(path, classIndex, isStatic, scriptIndex, abc, trait, methodInfo, body); } try (Statistics s = new Statistics("AVM2DeobfuscatorRegisters")) { - new AVM2DeobfuscatorRegistersOld().avm2CodeRemoveTraps(path, classIndex, isStatic, scriptIndex, abc, trait, methodInfo, body); + //new AVM2DeobfuscatorRegistersOld().avm2CodeRemoveTraps(path, classIndex, isStatic, scriptIndex, abc, trait, methodInfo, body); } try (Statistics s = new Statistics("AVM2DeobfuscatorJumps")) { new AVM2DeobfuscatorJumps().avm2CodeRemoveTraps(path, classIndex, isStatic, scriptIndex, abc, trait, methodInfo, body); ```