diff --git a/CHANGELOG.md b/CHANGELOG.md index 052c7e4cf..bc0574925 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,7 +49,8 @@ All notable changes to this project will be documented in this file. - AS1/2 P-code double Push values have suffix ".0" to properly distinguish them - AS1/2 P-code float Push values have suffix "f" to properly distinguish them - AS1/2: Export names are deobfuscated only when start with `__Packages.`, - if not, then classical escaping is performed (with quotes) + if not, then classical escaping is performed +- Quotes in tree node parameter values that need them ## [24.0.1] - 2025-06-27 ### Fixed diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/FrameLabelTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/FrameLabelTag.java index c5dd4f638..cdeefa951 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/FrameLabelTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/FrameLabelTag.java @@ -22,6 +22,7 @@ import com.jpexs.decompiler.flash.SWFOutputStream; import com.jpexs.decompiler.flash.types.annotations.Conditional; import com.jpexs.decompiler.flash.types.annotations.SWFVersion; import com.jpexs.helpers.ByteArrayRange; +import com.jpexs.helpers.Helper; import java.io.IOException; import java.util.Map; @@ -93,7 +94,7 @@ public class FrameLabelTag extends Tag { public Map getNameProperties() { Map ret = super.getNameProperties(); if (!name.isEmpty()) { - ret.put("name", name); + ret.put("name", "\"" + Helper.escapePCodeString(name) + "\""); } return ret; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/FontTag.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/FontTag.java index 3915a6cd3..5278786da 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/FontTag.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/tags/base/FontTag.java @@ -33,6 +33,7 @@ import com.jpexs.decompiler.flash.types.SHAPE; import com.jpexs.decompiler.flash.types.TEXTRECORD; import com.jpexs.decompiler.flash.types.shaperecords.SHAPERECORD; import com.jpexs.helpers.ByteArrayRange; +import com.jpexs.helpers.Helper; import com.jpexs.helpers.SerializableImage; import java.awt.Color; import java.awt.Font; @@ -394,7 +395,7 @@ public abstract class FontTag extends DrawableTag implements AloneTag { ret.put("chid", "" + getCharacterId()); String fontName = getFontNameIntag(); if (fontName != null) { - ret.put("fn", fontName); + ret.put("fn", "\"" + Helper.escapePCodeString(fontName) + "\""); } return ret; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Frame.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Frame.java index b5f516922..22f852e69 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Frame.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/timeline/Frame.java @@ -29,6 +29,7 @@ import com.jpexs.decompiler.flash.treeitems.TreeItem; import com.jpexs.decompiler.flash.types.RGB; import com.jpexs.decompiler.flash.types.RGBA; import com.jpexs.decompiler.flash.types.SOUNDINFO; +import com.jpexs.helpers.Helper; import java.util.ArrayList; import java.util.List; import java.util.Objects; @@ -161,7 +162,7 @@ public class Frame implements TreeItem, Exportable { List labels = new ArrayList<>(); for (Tag t : innerTags) { if (t instanceof FrameLabelTag) { - labels.add(((FrameLabelTag) t).name); + labels.add("\"" + Helper.escapePCodeString(((FrameLabelTag) t).name) + "\""); } } if (!labels.isEmpty()) { diff --git a/libsrc/ffdec_lib/testdata/as2/as2.swf b/libsrc/ffdec_lib/testdata/as2/as2.swf index 0b85f614d..6006adea4 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 069102500..d47205626 100644 --- a/libsrc/ffdec_lib/testdata/as2/as2/DOMDocument.xml +++ b/libsrc/ffdec_lib/testdata/as2/as2/DOMDocument.xml @@ -31,8 +31,18 @@ - + + + + + + + + + + + @@ -858,7 +868,7 @@ - + @@ -3479,6 +3489,8 @@ switch(test) + + @@ -3497,7 +3509,5 @@ switch(test) - - \ No newline at end of file diff --git a/libsrc/ffdec_lib/testdata/as2/as2/bin/SymDepend.cache b/libsrc/ffdec_lib/testdata/as2/as2/bin/SymDepend.cache index 70f06d085..43e15297a 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 diff --git a/src/com/jpexs/decompiler/flash/easygui/LibraryTreeTable.java b/src/com/jpexs/decompiler/flash/easygui/LibraryTreeTable.java index 763337d44..6bac609e0 100644 --- a/src/com/jpexs/decompiler/flash/easygui/LibraryTreeTable.java +++ b/src/com/jpexs/decompiler/flash/easygui/LibraryTreeTable.java @@ -30,6 +30,8 @@ import com.jpexs.decompiler.flash.tags.base.ShapeTag; import com.jpexs.decompiler.flash.tags.base.SoundTag; import com.jpexs.decompiler.flash.tags.base.TextTag; import com.jpexs.decompiler.flash.timeline.Timelined; +import com.jpexs.decompiler.graph.DottedChain; +import com.jpexs.helpers.Helper; import de.javagl.treetable.JTreeTable; import de.javagl.treetable.TreeTableModel; import java.awt.Color; @@ -38,6 +40,9 @@ import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; import javax.swing.JLabel; import javax.swing.JTree; import javax.swing.ListSelectionModel; @@ -384,12 +389,17 @@ public class LibraryTreeTable extends JTreeTable { case 1: if (o instanceof CharacterTag) { CharacterTag ct = (CharacterTag) o; - if (!ct.getClassNames().isEmpty()) { - return String.join(", ", ct.getClassNames()); + String exportName = ct.getExportName(); + if (exportName != null) { + return Helper.escapeExportname(exportName, false); } - String en = ct.getExportName(); - if (en != null) { - return en; + Set classNames = ct.getClassNames(); + if (!classNames.isEmpty()) { + List escapedList = new ArrayList<>(); + for (String className : classNames) { + escapedList.add(DottedChain.parseNoSuffix(className).toPrintableString(true)); + } + return String.join(", ", escapedList); } } return ""; diff --git a/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java b/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java index 23f23d0f4..7f9d2e198 100644 --- a/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java +++ b/src/com/jpexs/decompiler/flash/gui/GenericTagTreePanel.java @@ -911,14 +911,16 @@ public class GenericTagTreePanel extends GenericTagPanel { DottedIdentifier di = field.getAnnotation(DottedIdentifier.class); if (val instanceof String && di != null) { if (di.exportName()) { - valStr += " = " + Helper.escapeExportname(val.toString(), true); + valStr += " = " + escapeHtml(Helper.escapeExportname(val.toString(), true)); } else { - valStr += " = " + DottedChain.parseNoSuffix(val.toString()).toPrintableString(di.as3()); + valStr += " = " + escapeHtml(DottedChain.parseNoSuffix(val.toString()).toPrintableString(di.as3())); } } else if (val instanceof byte[]) { valStr += " = " + ((byte[]) val).length + " byte"; } else if (val instanceof ByteArrayRange) { valStr += " = " + ((ByteArrayRange) val).getLength() + " byte"; + } else if (val instanceof String) { + valStr += " = \"" + escapeHtml(Helper.escapePCodeString(val.toString())) + "\""; } else { valStr += " = " + colorAdd + escapeHtml(val.toString()) + enumAdd; }