Browse Source

Fix #2654: Ignore custom attributes on parameter where SequenceNumber is out-of-range.

This can occur when decoding the signature of a setter-only property, as the setter has an additional `value` parameter that does not appear in the property's signature.
pull/2660/head
Daniel Grunwald 3 years ago
parent
commit
cc7119e191
  1. 5
      ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataMethod.cs

5
ICSharpCode.Decompiler/TypeSystem/Implementation/MetadataMethod.cs

@ -233,11 +233,12 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation @@ -233,11 +233,12 @@ namespace ICSharpCode.Decompiler.TypeSystem.Implementation
returnTypeAttributes = par.GetCustomAttributes();
}
}
else if (par.SequenceNumber > 0 && i < signature.RequiredParameterCount)
else if (i < par.SequenceNumber && par.SequenceNumber <= signature.RequiredParameterCount)
{
// "Successive rows of the Param table that are owned by the same method shall be
// ordered by increasing Sequence value - although gaps in the sequence are allowed"
Debug.Assert(i < par.SequenceNumber);
Debug.Assert(par.SequenceNumber <= signature.ParameterTypes.Length);
Debug.Assert(par.SequenceNumber <= parameters.Length);
// Fill gaps in the sequence with non-metadata parameters:
while (i < par.SequenceNumber - 1)
{

Loading…
Cancel
Save