From 74cf717e9a4771ef72c16a3c96e8fc77ef7dc2c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jindra=20Pet=C5=99=C3=ADk?= Date: Sat, 3 Dec 2022 12:17:17 +0100 Subject: [PATCH] Fixed Parsing obfuscated namespaces with hash character "#" --- CHANGELOG.md | 1 + .../flash/abc/avm2/AVM2ConstantPool.java | 2 +- .../jpexs/decompiler/graph/DottedChain.java | 19 +++++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 92d1b74f9..6d456d8e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ All notable changes to this project will be documented in this file. ### Fixed - [#1897] Close menu button without selecting specific item - Reading UI32 values +- Parsing obfuscated namespaces with hash character "#" ### Changed - Quick search needs minimum of 3 characters diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ConstantPool.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ConstantPool.java index f826d8369..5a1b13890 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ConstantPool.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2ConstantPool.java @@ -663,7 +663,7 @@ public class AVM2ConstantPool implements Cloneable { String str = getString(index); DottedChain chain = dottedChainCache.get(str); if (chain == null) { - chain = DottedChain.parseWithSuffix(str); + chain = DottedChain.parseNoSuffix(str); dottedChainCache.put(str, chain); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/DottedChain.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/DottedChain.java index 9f53be65d..1861bea78 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/DottedChain.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/DottedChain.java @@ -88,6 +88,25 @@ public class DottedChain implements Serializable, Comparable { } + public static final DottedChain parseNoSuffix(String name) { + if (name == null) { + return DottedChain.EMPTY; + } else if (name.isEmpty()) { + return DottedChain.TOPLEVEL; + } else { + String parts[] = name.split("\\."); + String nsSuffixes[] = new String[parts.length]; + int i = 0; + for (String part : parts) { + String nameNoSuffix = part; + parts[i] = nameNoSuffix; + nsSuffixes[i] = ""; + i++; + } + + return new DottedChain(parts, nsSuffixes); + } + } public static final DottedChain parseWithSuffix(String name) { if (name == null) { return DottedChain.EMPTY;