diff --git a/CHANGELOG.md b/CHANGELOG.md index 50ce82363..40f378fc8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -78,6 +78,7 @@ All notable changes to this project will be documented in this file. - [#2142] XML Export - string values containing only spaces - AS3 - Nullpointer in MethodBody when no ABC set - [#2148] AS2 Uninitialized class fields detector +- [#2148] AS1/2 callmethod by register value ### Changed - [#2120] Exported assets no longer take names from assigned classes if there is more than 1 assigned class diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/CallMethodActionItem.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/CallMethodActionItem.java index d628cc44c..2e64ad7e9 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/CallMethodActionItem.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/CallMethodActionItem.java @@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.action.model; import com.jpexs.decompiler.flash.IdentifiersDeobfuscation; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; +import com.jpexs.decompiler.flash.action.swf4.RegisterNumber; import com.jpexs.decompiler.flash.action.swf5.ActionCallMethod; import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; @@ -125,7 +126,10 @@ public class CallMethodActionItem extends ActionItem { } else { scriptObject.toString(writer, localData); } - if (IdentifiersDeobfuscation.isValidName(false, methodName.toStringNoQuotes(localData))) { + if ( + !(((DirectValueActionItem)methodName).value instanceof RegisterNumber) + && IdentifiersDeobfuscation.isValidName(false, methodName.toStringNoQuotes(localData)) + ) { writer.append("."); methodName.toStringNoQuotes(writer, localData); } else { diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript2Test.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript2Test.java index 0b1916049..92f092f65 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript2Test.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript2Test.java @@ -2408,4 +2408,25 @@ public class ActionScript2Test extends ActionScript2TestBase { + "}\r\n" ); } + + @Test + public void frame87_CallRegisterTest() { + compareSrc(87, "function tst(o)\r\n" + + "{\r\n" + + "var _loc1_ = \"a\";\r\n" + + "o[_loc1_]();\r\n" + + "}\r\n" + + "trace(\"CallRegisterTest\");\r\n" + + "var f = function()\r\n" + + "{\r\n" + + "trace(\"A\");\r\n" + + "};\r\n" + + "var g = function()\r\n" + + "{\r\n" + + "trace(\"B\");\r\n" + + "};\r\n" + + "var obj = {a:f,b:g};\r\n" + + "tst(obj);\r\n" + ); + } } diff --git a/libsrc/ffdec_lib/testdata/as2/as2.swf b/libsrc/ffdec_lib/testdata/as2/as2.swf index fd9e20900..64b420e58 100644 Binary files a/libsrc/ffdec_lib/testdata/as2/as2.swf and b/libsrc/ffdec_lib/testdata/as2/as2.swf differ diff --git a/libsrc/ffdec_lib/testdata/as2/as2/DOMDocument.xml b/libsrc/ffdec_lib/testdata/as2/as2/DOMDocument.xml index d05819daa..903014524 100644 --- a/libsrc/ffdec_lib/testdata/as2/as2/DOMDocument.xml +++ b/libsrc/ffdec_lib/testdata/as2/as2/DOMDocument.xml @@ -1,7 +1,7 @@ - + @@ -31,7 +31,7 @@ - + @@ -761,9 +761,9 @@ +!3156 7501[3091 7490 3054 7490!3054 7490[3050 7494 3050 7457!3050 7457[3050 7441 3159 7239!3159 7239[3270 7033 3327 6947!3327 6947[3353 6908 3412 6794!3412 6794[3470 6682 3500 6639!3500 6639[3602 6491 3649 6692!3649 6692|3713 6670!3713 + 6670[3760 6655 3782 6655!3782 6655[3942 6655 3985 6781!3985 6781[4007 6844 3996 6914!3996 6914[3996 6948 3999 6995!3999 6995[4000 7031 3993 7054!3993 7054[3976 7106 3860 7224!3860 7224[3847 7237 3741 7292!3741 7292[3638 7346 3616 7372 +!3616 7372[3594 7396 3511 7442!3511 7442[3435 7483 3427 7483!3427 7483[3409 7483 3407 7468!3407 7468[3405 7453 3386 7453!3386 7453[3361 7468 3330 7483!3330 7483[3270 7512 3235 7512!3235 7512[3220 7512 3156 7501"/> + @@ -1009,7 +1009,7 @@ - + @@ -3321,6 +3321,26 @@ for(var thing in obj) { + + + + + + @@ -3328,6 +3348,10 @@ for(var thing in obj) { + + + + @@ -3344,9 +3368,5 @@ for(var thing in obj) { - - - - \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/as2/as2/LIBRARY/NineSlice.xml b/libsrc/ffdec_lib/testdata/as2/as2/LIBRARY/NineSlice.xml index eaff2309c..5c2332e03 100644 --- a/libsrc/ffdec_lib/testdata/as2/as2/LIBRARY/NineSlice.xml +++ b/libsrc/ffdec_lib/testdata/as2/as2/LIBRARY/NineSlice.xml @@ -37,22 +37,26 @@ - - - - - - - - + + - - + + + + + + + diff --git a/libsrc/ffdec_lib/testdata/as2/as2/LIBRARY/blue.xml b/libsrc/ffdec_lib/testdata/as2/as2/LIBRARY/blue.xml index 32e670e1f..7aa0f1c9f 100644 --- a/libsrc/ffdec_lib/testdata/as2/as2/LIBRARY/blue.xml +++ b/libsrc/ffdec_lib/testdata/as2/as2/LIBRARY/blue.xml @@ -36,8 +36,8 @@ trace("init_blue"); - + diff --git a/libsrc/ffdec_lib/testdata/as2/as2/META-INF/metadata.xml b/libsrc/ffdec_lib/testdata/as2/as2/META-INF/metadata.xml index 2ffd1a058..a5dd95f75 100644 --- a/libsrc/ffdec_lib/testdata/as2/as2/META-INF/metadata.xml +++ b/libsrc/ffdec_lib/testdata/as2/as2/META-INF/metadata.xml @@ -5,8 +5,8 @@ xmlns:xmp="http://ns.adobe.com/xap/1.0/"> Adobe Flash CS4 Professional 2010-08-03T10:48:58+02:00 - 2023-03-16T08:40:37-07:00 - 2023-03-16T08:40:37-07:00 + 2023-12-10T13:27:42-08:00 + 2023-12-10T13:27:42-08:00 @@ -22,7 +22,7 @@ xmp.did:8DD71700DC9EDF1194ADAC9B23608190 xmp.did:F0EB4FF7CAC3ED11AC9DC078F41E1AA7 - xmp.iid:F0EB4FF7CAC3ED11AC9DC078F41E1AA7 + xmp.iid:37EB8B269097EE11BB10B6D1BEF0E058 xmp.did:8DD71700DC9EDF1194ADAC9B23608190 @@ -446,6 +446,12 @@ 2010-08-03T10:48:58+02:00 Adobe Flash Professional CS6 - build 481 + + created + xmp.iid:37EB8B269097EE11BB10B6D1BEF0E058 + 2010-08-03T10:48:58+02:00 + Adobe Flash Professional CS6 - build 481 + diff --git a/libsrc/ffdec_lib/testdata/as2/as2/PublishSettings.xml b/libsrc/ffdec_lib/testdata/as2/as2/PublishSettings.xml index cd07bc82e..f42d814ed 100644 --- a/libsrc/ffdec_lib/testdata/as2/as2/PublishSettings.xml +++ b/libsrc/ffdec_lib/testdata/as2/as2/PublishSettings.xml @@ -38,8 +38,8 @@ 10,0,2,0;11,4,0,0;11,3,0,0;12,0,0,0;11,2,0,0;11,1,0,0;10,3,0,0;10,2,153,0;10,1,52,0;9,0,124,0;8,0,24,0;7,0,14,0;6,0,79,0;5,0,58,0;4,0,32,0;3,0,8,0;2,0,1,12;1,0,0,1; 1 1 - as2_content.html - as2_alternate.html + as2.xfl_content.html + as2.xfl_alternate.html 0 550 diff --git a/libsrc/ffdec_lib/testdata/as2/as2/bin/SymDepend.cache b/libsrc/ffdec_lib/testdata/as2/as2/bin/SymDepend.cache index 1185405c7..5b211b31d 100644 Binary files a/libsrc/ffdec_lib/testdata/as2/as2/bin/SymDepend.cache and b/libsrc/ffdec_lib/testdata/as2/as2/bin/SymDepend.cache differ