Browse Source

Fix crash when IL byte code unexpectedly ends in the middle of an operand.

pull/2693/head
Daniel Grunwald 3 years ago
parent
commit
d6d0392d2f
  1. 10
      ICSharpCode.Decompiler/CSharp/RequiredNamespaceCollector.cs

10
ICSharpCode.Decompiler/CSharp/RequiredNamespaceCollector.cs

@ -302,7 +302,15 @@ namespace ICSharpCode.Decompiler.CSharp @@ -302,7 +302,15 @@ namespace ICSharpCode.Decompiler.CSharp
case OperandType.Sig:
case OperandType.Tok:
case OperandType.Type:
var handle = MetadataTokenHelpers.EntityHandleOrNil(instructions.ReadInt32());
EntityHandle handle;
try
{
handle = MetadataTokenHelpers.EntityHandleOrNil(instructions.ReadInt32());
}
catch (BadImageFormatException)
{
return;
}
if (handle.IsNil)
break;
switch (handle.Kind)

Loading…
Cancel
Save