Handle call instrs with invalid metadata tokens

This commit is contained in:
de4dot 2011-11-04 07:43:24 +01:00
parent 4ce90dbfc0
commit 49b2976965

View File

@ -470,11 +470,16 @@ namespace de4dot.deobfuscators {
// May not return all args. The args are returned in reverse order.
PushedArgs getPushedArgInstructions(IList<Instruction> instructions, int index) {
int pushes, pops;
DotNetUtils.calculateStackUsage(instructions[index], false, out pushes, out pops);
if (pops == -1)
return new PushedArgs(0);
return getPushedArgInstructions(instructions, index, pops);
try {
int pushes, pops;
DotNetUtils.calculateStackUsage(instructions[index], false, out pushes, out pops);
if (pops != -1)
return getPushedArgInstructions(instructions, index, pops);
}
catch (System.NullReferenceException) {
// Here if eg. invalid metadata token in a call instruction (operand is null)
}
return new PushedArgs(0);
}
// May not return all args. The args are returned in reverse order.