We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 967de58 commit 6aa9bd8Copy full SHA for 6aa9bd8
ICSharpCode.Decompiler/IL/ILReader.cs
@@ -212,7 +212,14 @@ EntityHandle ReadAndDecodeMetadataToken()
212
// Row-IDs < 1 are always invalid.
213
throw new BadImageFormatException("Invalid metadata token");
214
}
215
- return MetadataTokens.EntityHandle(token);
+ var handle = MetadataTokens.EntityHandle(token);
216
+ if (handle.IsNil)
217
+ {
218
+ // The runtime will crash with a BadImageFormatException when it encounters a row-ID of 0.
219
+ // We assume the code following this instruction to be unreachable.
220
+ throw new BadImageFormatException("Invalid metadata token");
221
+ }
222
+ return handle;
223
224
225
IType ReadAndDecodeTypeReference()
0 commit comments