From 7d1f4db77571778cabd2362c56cab8eb9bc2dcc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sat, 7 Oct 2023 16:47:04 +0200 Subject: [PATCH] Fixed Embed tag not properly escaped on obfuscated files --- CHANGELOG.md | 1 + .../jpexs/decompiler/flash/abc/types/InstanceInfo.java | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 193671f7b..f14bced4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ All notable changes to this project will be documented in this file. - AS3 incorrect private modifier on internal namespaced traits of private class inside script - [#2095] AS3 Changing script when debugging - [#223] AS2 Detecting uninitialized class fields +- Embed tag not properly escaped on obfuscated files ## [19.0.0] - 2023-10-01 ### Added diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/InstanceInfo.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/InstanceInfo.java index b64dfbe2d..20fb3e466 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/InstanceInfo.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/InstanceInfo.java @@ -106,7 +106,7 @@ public class InstanceInfo { writer.appendNoHilight("[Embed(source=\"" + ASSETS_DIR + ct.getCharacterExportFileName() + ((ImageTag) ct).getImageFormat().getExtension() + "\")]").newLine(); } if (ct instanceof DefineSpriteTag) { - writer.appendNoHilight("[Embed(source=\"" + ASSETS_DIR + "assets.swf\", symbol=\"" + className + "\")]").newLine(); + writer.appendNoHilight("[Embed(source=\"" + ASSETS_DIR + "assets.swf\", symbol=\"" + Helper.escapeActionScriptString(className) + "\")]").newLine(); } if (ct instanceof DefineSoundTag) { //should be mp3, otherwise it won't work. Should we convert this? @@ -126,8 +126,8 @@ public class InstanceInfo { } writer.appendNoHilight("[Embed(source=\"" + ASSETS_DIR + ct.getCharacterExportFileName() + ".ttf\",").newLine(); - writer.appendNoHilight("fontName=\"" + ft.getFontNameIntag() + "\",").newLine(); - writer.appendNoHilight("fontFamily=\"" + ft.getFontName()+ "\",").newLine(); + writer.appendNoHilight("fontName=\"" + Helper.escapeActionScriptString(ft.getFontNameIntag()) + "\",").newLine(); + writer.appendNoHilight("fontFamily=\"" + Helper.escapeActionScriptString(ft.getFontName())+ "\",").newLine(); writer.appendNoHilight("mimeType=\"application/x-font\",").newLine(); writer.appendNoHilight("fontWeight=\"" + (ft.isBold() ? "bold" : "normal") + "\",").newLine(); writer.appendNoHilight("fontStyle=\"" + (ft.isItalic() ? "italic" : "normal") + "\",").newLine(); @@ -175,7 +175,7 @@ public class InstanceInfo { if (ct instanceof DefineFont4Tag) { DefineFont4Tag ft4 = (DefineFont4Tag)ct; writer.appendNoHilight("[Embed(source=\"" + ASSETS_DIR + ct.getCharacterExportFileName() + ".cff\",").newLine(); - writer.appendNoHilight("fontName=\"" + ft4.fontName + "\",").newLine(); + writer.appendNoHilight("fontName=\"" + Helper.escapeActionScriptString(ft4.fontName) + "\",").newLine(); writer.appendNoHilight("mimeType=\"application/x-font\",").newLine(); writer.appendNoHilight("fontWeight=\"" + (ft4.fontFlagsBold ? "bold" : "normal") + "\",").newLine(); writer.appendNoHilight("fontStyle=\"" + (ft4.fontFlagsItalic ? "italic" : "normal") + "\",").newLine();