JPEXS Free Flash Decompiler Issue Tracker

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

NEW : You can now close your own issues and reopen them later if needed. You can also comment closed issues.
List of issuesList of issues

Previous not availableNext#2784 AS3 direct editation: super.method() is compiled as a global name lookup when the class hierarchy has a member named super
Date created:
Type: bug
Visibility: Everybody
Assigned to:
Labels: AS3
State: upgraded Help

> What steps will reproduce the problem? 1. Decompile a class whose base class declares a member named `super`. This is legal in ABC, e.g. a class may declare `public function super(param1:int, param2:int, param3:int) : Boolean`. 2. Recompile it, without editing anything: java -jar ffdec-cli.jar -cli -replace in.swf out.swf "MyClass" MyClass.as 3. Open the resulting SWF, or export p-code of the class. Minimal reproduction (no large SWF needed; uses the bundled testdata SWF): - take testdata/as3_ctor_field_init/bin/as3_ctor_field_init.swf - replace tests_classes.TestCtorDependsOnBaseSlotBase (attached as Base2.as) with a source that declares a method named super (fragment): public var testProp:int = 0; public function §super§(param1:int) : int { return param1; } - replace tests_classes.TestCtorDependsOnBaseSlot (attached as Sub2.as) with: override public function ping() : int { super.testProp = 5; return super.ping(); } - commands: java -jar ffdec-cli.jar -cli -replace in.swf step1.swf "tests_classes.TestCtorDependsOnBaseSlotBase" Base2.as java -jar ffdec-cli.jar -cli -replace step1.swf step2.swf "tests_classes.TestCtorDependsOnBaseSlot" Sub2.as java -jar ffdec-cli.jar -cli -format script:pcode -export script out step2.swf (the full sources are the attached Base2.as / Sub2.as; the SWF produced by these two commands is attached as m2-unpatched.swf, 1,942 bytes) > What is the expected output? What do you see instead? Expected (same shape as the ASC compiler, see testexpected/as3_new/tests/TestConvert.as:358-361): pushbyte 5 findproperty QName(PackageNamespace(""),"testProp") swap setsuper QName(PackageNamespace(""),"testProp") getlocal0 callsuper QName(PackageNamespace(""),"ping"), 0 Actual: getlex QName(PackageNamespace(""),"super") pushbyte 5 setproperty Multiname("testProp",[...]) getlex QName(PackageNamespace(""),"super") callproperty Multiname("ping",[...]), 0 super.method() is compiled as a global name lookup plus a virtual call. The generated SWF fails at runtime as soon as the method executes: the global lookup cannot be resolved, so the following call is made on a missing/null object, so a plain decompile -> edit -> recompile round trip of such a class is broken. super.field = value has the same problem (setproperty instead of setsuper). Root cause: UnresolvedAVM2Item.isScopeProperty() probes the scope chain with the first name segment. When the class hierarchy really declares a member named "super", the probe succeeds and isProperty becomes true; resolve() then skips resolveThisOrSuper() and the generic path is taken. resolveThisOrSuper() is what builds the NameAVM2Item("super") that makes CallAVM2Item / PropertyAVM2Item emit callsuper / setsuper. Proposed fix (PR will follow against dev): private boolean isScopeProperty(...) { boolean isProperty = false; if (name.size() > 0 && name.get(0).equals("super")) { return false; } > What version of the product are you using? Is it "nightly build"? Which operating system do you have? FFDec 26.4.0 nightly build 3631. Also reproducible with 24.1.2. Java 17.0.2, Windows 11. > Please provide any additional information below. If the problem is related to a SWF file, attach it here, otherwise we can't help you. Verified on a real-world SWF (58 MB): one level class overrides onStart() and calls super.onStart(). - recompiled with the unpatched compiler: getlex "super" x2, callsuper 0 -> the game crashes when the level starts; - recompiled with the patched build: getlex "super" 0, callsuper 2 -> the level runs. Same source, same save file, same file name; only the compiler differs.
DownloadBase2.as (476 B)DownloadSub2.as (494 B)Downloadm2-unpatched.swf (2 KiB)
System
GitHub commit - fix(as3): compile super.method() as callsuper (#2784, PR315)
System
Upcoming nightly version: 3632
Thank you for reporting and PR, it will be part of nightly 3632.
State: new→upgraded
System
Nightly version 3632 released.