|
|
@ -311,12 +311,13 @@ public class ExceptionDeobfuscator { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static boolean handleMultipleEntryExceptionRanges(ControlFlowGraph graph) { |
|
|
|
public static boolean handleMultipleEntryExceptionRanges(ControlFlowGraph graph) { |
|
|
|
|
|
|
|
|
|
|
|
GenericDominatorEngine engine = new GenericDominatorEngine(new IGraph() { |
|
|
|
GenericDominatorEngine engine = new GenericDominatorEngine(new IGraph() { |
|
|
|
|
|
|
|
@Override |
|
|
|
public List<? extends IGraphNode> getReversePostOrderList() { |
|
|
|
public List<? extends IGraphNode> getReversePostOrderList() { |
|
|
|
return graph.getReversePostOrder(); |
|
|
|
return graph.getReversePostOrder(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public Set<? extends IGraphNode> getRoots() { |
|
|
|
public Set<? extends IGraphNode> getRoots() { |
|
|
|
return new HashSet<>(Collections.singletonList(graph.getFirst())); |
|
|
|
return new HashSet<>(Collections.singletonList(graph.getFirst())); |
|
|
|
} |
|
|
|
} |
|
|
@ -324,7 +325,7 @@ public class ExceptionDeobfuscator { |
|
|
|
|
|
|
|
|
|
|
|
engine.initialize(); |
|
|
|
engine.initialize(); |
|
|
|
|
|
|
|
|
|
|
|
boolean found = false; |
|
|
|
boolean found; |
|
|
|
|
|
|
|
|
|
|
|
while (true) { |
|
|
|
while (true) { |
|
|
|
found = false; |
|
|
|
found = false; |
|
|
@ -352,7 +353,6 @@ public class ExceptionDeobfuscator { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static Set<BasicBlock> getRangeEntries(ExceptionRangeCFG range) { |
|
|
|
private static Set<BasicBlock> getRangeEntries(ExceptionRangeCFG range) { |
|
|
|
|
|
|
|
|
|
|
|
Set<BasicBlock> setEntries = new HashSet<>(); |
|
|
|
Set<BasicBlock> setEntries = new HashSet<>(); |
|
|
|
Set<BasicBlock> setRange = new HashSet<>(range.getProtectedRange()); |
|
|
|
Set<BasicBlock> setRange = new HashSet<>(range.getProtectedRange()); |
|
|
|
|
|
|
|
|
|
|
@ -368,8 +368,10 @@ public class ExceptionDeobfuscator { |
|
|
|
return setEntries; |
|
|
|
return setEntries; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private static boolean splitExceptionRange(ExceptionRangeCFG range, Set<BasicBlock> setEntries, ControlFlowGraph graph, GenericDominatorEngine engine) { |
|
|
|
private static boolean splitExceptionRange(ExceptionRangeCFG range, |
|
|
|
|
|
|
|
Set<BasicBlock> setEntries, |
|
|
|
|
|
|
|
ControlFlowGraph graph, |
|
|
|
|
|
|
|
GenericDominatorEngine engine) { |
|
|
|
for (BasicBlock entry : setEntries) { |
|
|
|
for (BasicBlock entry : setEntries) { |
|
|
|
List<BasicBlock> lstSubrangeBlocks = getReachableBlocksRestricted(entry, range, engine); |
|
|
|
List<BasicBlock> lstSubrangeBlocks = getReachableBlocksRestricted(entry, range, engine); |
|
|
|
if (!lstSubrangeBlocks.isEmpty() && lstSubrangeBlocks.size() < range.getProtectedRange().size()) { |
|
|
|
if (!lstSubrangeBlocks.isEmpty() && lstSubrangeBlocks.size() < range.getProtectedRange().size()) { |
|
|
@ -379,7 +381,8 @@ public class ExceptionDeobfuscator { |
|
|
|
// shrink the original range
|
|
|
|
// shrink the original range
|
|
|
|
range.getProtectedRange().removeAll(lstSubrangeBlocks); |
|
|
|
range.getProtectedRange().removeAll(lstSubrangeBlocks); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} else { |
|
|
|
} |
|
|
|
|
|
|
|
else { |
|
|
|
// should not happen
|
|
|
|
// should not happen
|
|
|
|
DecompilerContext.getLogger().writeMessage("Inconsistency found while splitting protected range", IFernflowerLogger.Severity.WARN); |
|
|
|
DecompilerContext.getLogger().writeMessage("Inconsistency found while splitting protected range", IFernflowerLogger.Severity.WARN); |
|
|
|
} |
|
|
|
} |
|
|
@ -389,7 +392,6 @@ public class ExceptionDeobfuscator { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void insertDummyExceptionHandlerBlocks(ControlFlowGraph graph, int bytecode_version) { |
|
|
|
public static void insertDummyExceptionHandlerBlocks(ControlFlowGraph graph, int bytecode_version) { |
|
|
|
|
|
|
|
|
|
|
|
Map<BasicBlock, Set<ExceptionRangeCFG>> mapRanges = new HashMap<>(); |
|
|
|
Map<BasicBlock, Set<ExceptionRangeCFG>> mapRanges = new HashMap<>(); |
|
|
|
for (ExceptionRangeCFG range : graph.getExceptions()) { |
|
|
|
for (ExceptionRangeCFG range : graph.getExceptions()) { |
|
|
|
mapRanges.computeIfAbsent(range.getHandler(), k -> new HashSet<>()).add(range); |
|
|
|
mapRanges.computeIfAbsent(range.getHandler(), k -> new HashSet<>()).add(range); |
|
|
@ -443,5 +445,4 @@ public class ExceptionDeobfuscator { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |