Commit 94e9291c authored by Daniel Ramos's avatar Daniel Ramos

Fixed issue where postProcess may overwrite Deobfuscated method names.

The function will now check if the method name was aliased by Deobfuscation and if so it will use that name for all the overriden methods. Note: If the deobfuscation file contains two names for the same overriden method in two related Classes then the name that "wins" is non-deterministic.
parent 459d133b
......@@ -16,7 +16,6 @@ import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
......@@ -111,22 +110,23 @@ public class Deobfuscator {
private void postProcess() {
int id = 1;
for (OverridedMethodsNode o : ovrd) {
Iterator<MethodInfo> it = o.getMethods().iterator();
if (it.hasNext()) {
MethodInfo mth = it.next();
if (mth.isRenamed() && !mth.isAliasFromPreset()) {
mth.setAlias(String.format("mo%d%s", id, makeName(mth.getName())));
boolean aliasFromPreset = false;
String aliasToUse = null;
for(MethodInfo mth : o.getMethods()){
if(mth.isAliasFromPreset()) {
aliasToUse = mth.getAlias();
aliasFromPreset = true;
}
String firstMethodAlias = mth.getAlias();
while (it.hasNext()) {
mth = it.next();
if (!mth.getAlias().equals(firstMethodAlias)) {
mth.setAlias(firstMethodAlias);
}
for(MethodInfo mth : o.getMethods()){
if(aliasToUse == null) {
if (mth.isRenamed() && !mth.isAliasFromPreset()) {
mth.setAlias(String.format("mo%d%s", id, makeName(mth.getName())));
}
aliasToUse = mth.getAlias();
}
mth.setAlias(aliasToUse);
mth.setAliasFromPreset(aliasFromPreset);
}
id++;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment