DottedChain namespace fix

This commit is contained in:
honfika@gmail.com
2015-07-14 22:14:55 +02:00
parent c4530dfdd5
commit 602a2f0a63
2 changed files with 13 additions and 14 deletions

View File

@@ -109,7 +109,7 @@ public class ABC {
public ABCContainerTag parentTag;
/* Map from multiname index of namespace value to namespace name**/
private Map<DottedChain, DottedChain> namespaceMap;
private Map<String, DottedChain> namespaceMap;
public ABC(ABCContainerTag tag) {
this.parentTag = tag;
@@ -814,15 +814,15 @@ public class ABC {
}
}
private Map<DottedChain, DottedChain> getNamespaceMap() {
private Map<String, DottedChain> getNamespaceMap() {
if (namespaceMap == null) {
Map<DottedChain, DottedChain> map = new HashMap<>();
Map<String, DottedChain> map = new HashMap<>();
for (ScriptInfo si : script_info) {
for (Trait t : si.traits.traits) {
if (t instanceof TraitSlotConst) {
TraitSlotConst s = ((TraitSlotConst) t);
if (s.isNamespace()) {
DottedChain key = constants.getNamespace(s.value_index).getName(constants); // assume not null
String key = constants.getNamespace(s.value_index).getName(constants).toRawString(); // assume not null
DottedChain val = constants.getMultiname(s.name_index).getNameWithNamespace(constants);
map.put(key, val);
}
@@ -858,10 +858,16 @@ public class ABC {
}
public DottedChain nsValueToName(DottedChain value) {
if (getNamespaceMap().containsKey(value)) {
return getNamespaceMap().get(value);
if (value == null) {
return null;
}
String valueStr = value.toRawString();
if (getNamespaceMap().containsKey(valueStr)) {
return getNamespaceMap().get(valueStr);
} else {
DottedChain ns = getDeobfuscation().builtInNs(value);
DottedChain ns = getDeobfuscation().builtInNs(valueStr);
if (ns == null) {
return DottedChain.EMPTY;
} else {

View File

@@ -96,13 +96,6 @@ public class AVM2Deobfuscation {
return isValid;
}
public DottedChain builtInNs(DottedChain ns) {
if (ns == null || ns.size() != 1) {
return null;
}
return builtInNs(ns.get(0));
}
public DottedChain builtInNs(String ns) {
if (ns == null) {
return null;