Use next handler if end is reached
This commit is contained in:
parent
e1d4663f57
commit
ff3b87e42e
|
@ -53,10 +53,10 @@ namespace de4dot.code.deobfuscators.Agile_NET.vm.v2 {
|
||||||
public readonly int BlockIndex;
|
public readonly int BlockIndex;
|
||||||
public int HashIndex;
|
public int HashIndex;
|
||||||
|
|
||||||
public HandlerState(List<BlockSigInfo> blockSigInfos, int blockIndex, int instructionIndex) {
|
public HandlerState(List<BlockSigInfo> blockSigInfos, int blockIndex, int hashIndex) {
|
||||||
this.BlockSigInfos = blockSigInfos;
|
this.BlockSigInfos = blockSigInfos;
|
||||||
this.BlockIndex = blockIndex;
|
this.BlockIndex = blockIndex;
|
||||||
this.HashIndex = instructionIndex;
|
this.HashIndex = hashIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HandlerState Clone() {
|
public HandlerState Clone() {
|
||||||
|
@ -164,6 +164,8 @@ namespace de4dot.code.deobfuscators.Agile_NET.vm.v2 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (nextState == null && findState.VisitedCompositeBlocks.Count != findState.CompositeState.BlockSigInfos.Count)
|
||||||
|
nextState = GetNextHandlerState(ref findState);
|
||||||
if (nextState == null) {
|
if (nextState == null) {
|
||||||
if (findState.VisitedCompositeBlocks.Count != findState.CompositeState.BlockSigInfos.Count)
|
if (findState.VisitedCompositeBlocks.Count != findState.CompositeState.BlockSigInfos.Count)
|
||||||
return false;
|
return false;
|
||||||
|
@ -181,6 +183,16 @@ namespace de4dot.code.deobfuscators.Agile_NET.vm.v2 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static HandlerState? GetNextHandlerState(ref FindHandlerState findState) {
|
||||||
|
for (int i = 0; i < findState.CompositeState.BlockSigInfos.Count; i++) {
|
||||||
|
if (findState.VisitedCompositeBlocks.ContainsKey(i))
|
||||||
|
continue;
|
||||||
|
return new HandlerState(findState.CompositeState.BlockSigInfos, i, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
static bool Compare(ref HandlerState handler, ref HandlerState composite) {
|
static bool Compare(ref HandlerState handler, ref HandlerState composite) {
|
||||||
var hhashes = handler.BlockSigInfos[handler.BlockIndex].Hashes;
|
var hhashes = handler.BlockSigInfos[handler.BlockIndex].Hashes;
|
||||||
int hi = handler.HashIndex;
|
int hi = handler.HashIndex;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user