Handle call instrs with invalid metadata tokens
This commit is contained in:
parent
4ce90dbfc0
commit
49b2976965
|
@ -470,11 +470,16 @@ namespace de4dot.deobfuscators {
|
||||||
|
|
||||||
// May not return all args. The args are returned in reverse order.
|
// May not return all args. The args are returned in reverse order.
|
||||||
PushedArgs getPushedArgInstructions(IList<Instruction> instructions, int index) {
|
PushedArgs getPushedArgInstructions(IList<Instruction> instructions, int index) {
|
||||||
int pushes, pops;
|
try {
|
||||||
DotNetUtils.calculateStackUsage(instructions[index], false, out pushes, out pops);
|
int pushes, pops;
|
||||||
if (pops == -1)
|
DotNetUtils.calculateStackUsage(instructions[index], false, out pushes, out pops);
|
||||||
return new PushedArgs(0);
|
if (pops != -1)
|
||||||
return getPushedArgInstructions(instructions, index, pops);
|
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.
|
// May not return all args. The args are returned in reverse order.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user