From 4128b98dbb41032053d775a0b254757e056fb79f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Thu, 3 Jul 2025 20:53:03 +0200 Subject: [PATCH] Fixed: Flash player preview not stripping scripts from DefineSprites --- CHANGELOG.md | 1 + .../flash/exporters/PreviewExporter.java | 2 +- .../flash/tags/DefineSpriteTag.java | 22 ++++++++++++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f35464a4..73924e22a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ All notable changes to this project will be documented in this file. - Comments color highlighting - AS1/2 Obfuscated registers names not resolving because of trimming - Escaping HTML in raw tag editor +- Flash player preview not stripping scripts from DefineSprites ### Changed - Icon of "Deobfuscation options" menu from pile of pills to medkit diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/PreviewExporter.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/PreviewExporter.java index dd4623fb9..21a710ef1 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/PreviewExporter.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/exporters/PreviewExporter.java @@ -703,7 +703,7 @@ public class PreviewExporter { doneCharacters.add(chId); } - t.writeTag(sos); + t.writeTagNoScripts(sos); if (t instanceof CharacterIdTag) { List chIdTags = t.getSwf().getCharacterIdTags(((CharacterIdTag) t).getCharacterId()); if (chIdTags != null) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java index bd766aab8..e0d84d112 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/DefineSpriteTag.java @@ -149,6 +149,26 @@ public class DefineSpriteTag extends DrawableTag implements Timelined { sos.writeUI16(0); } } + + @Override + public void getDataNoScript(SWFOutputStream sos) throws IOException { + sos.writeUI16(spriteId); + sos.writeUI16(frameCount); + ReadOnlyTagList tags = getTags(); + for (Tag t : tags) { + if (t instanceof DoActionTag + || t instanceof DoInitActionTag + || t instanceof ABCContainerTag + || t instanceof SymbolClassTag + || t instanceof ExportAssetsTag) { + continue; + } + t.writeTagNoScripts(sos); + } + if (hasEndTag) { + sos.writeUI16(0); + } + } @Override public Timeline getTimeline() { @@ -510,5 +530,5 @@ public class DefineSpriteTag extends DrawableTag implements Timelined { @Override public void setFrameCount(int frameCount) { this.frameCount = frameCount; - } + } }