From fc553adb9862a4b9c13ea082bf7c9bc8b61aeba2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Fri, 17 Jan 2025 20:58:03 +0100 Subject: [PATCH] Fixed: [#2394] Broken deobfuscation on incorrect length of ActionStrictMode Fixed: [#2394] ActionStrictMode with mode larger than 1 now ignored --- CHANGELOG.md | 3 +++ .../src/com/jpexs/decompiler/flash/SWFInputStream.java | 2 +- .../flash/action/flashlite/ActionStrictMode.java | 8 ++++++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f06ea384..41bbde36b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,8 @@ All notable changes to this project will be documented in this file. - AS1/2 - Push action hilighting, GetProperty, Call action hilighting - [#2381] Font color values with alpha allowed in html edittext, but alpha ignored - [#2384] Vanishing pins on AS3 code editing save, on script deletion and few other cases +- [#2394] Broken deobfuscation on incorrect length of ActionStrictMode, +- [#2394] ActionStrictMode with mode larger than 1 now ignored ## [22.0.1] - 2024-11-20 ### Added @@ -3686,6 +3688,7 @@ Major version of SWF to XML export changed to 2. [#2389]: https://www.free-decompiler.com/flash/issues/2389 [#2381]: https://www.free-decompiler.com/flash/issues/2381 [#2384]: https://www.free-decompiler.com/flash/issues/2384 +[#2394]: https://www.free-decompiler.com/flash/issues/2394 [#2366]: https://www.free-decompiler.com/flash/issues/2366 [#2367]: https://www.free-decompiler.com/flash/issues/2367 [#2372]: https://www.free-decompiler.com/flash/issues/2372 diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFInputStream.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFInputStream.java index 97da529ed..5b1846981 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFInputStream.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWFInputStream.java @@ -1942,7 +1942,7 @@ public class SWFInputStream implements AutoCloseable { case 0x2D: return new ActionFSCommand2(getCharset()); case 0x89: - return new ActionStrictMode(this); + return new ActionStrictMode(actionLength, this); // SWF3 Actions case 0x81: return new ActionGotoFrame(actionLength, this); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/flashlite/ActionStrictMode.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/flashlite/ActionStrictMode.java index eb236a322..cd5822843 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/flashlite/ActionStrictMode.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/flashlite/ActionStrictMode.java @@ -57,11 +57,12 @@ public class ActionStrictMode extends Action { /** * Constructor + * @param actionLength Action length * @param sis SWF input stream * @throws IOException On I/O error */ - public ActionStrictMode(SWFInputStream sis) throws IOException { - super(0x89, 1, sis.getCharset()); + public ActionStrictMode(int actionLength, SWFInputStream sis) throws IOException { + super(0x89, actionLength, sis.getCharset()); mode = sis.readUI8("mode"); } @@ -104,6 +105,9 @@ public class ActionStrictMode extends Action { @Override public void translate(Map> uninitializedClassTraits, SecondPassData secondPassData, boolean insideDoInitAction, GraphSourceItem lineStartItem, TranslateStack stack, List output, HashMap regNames, HashMap variables, HashMap functions, int staticOperation, String path) { + if (mode != 1) { + return; + } output.add(new StrictModeActionItem(this, lineStartItem, mode)); } }