[cil-strip] Fix reading of undefined NativeType values in old Cecil (#13954)
commitec045a52b03387d61a50dfd414029bb191237a76
authorAlexander Köplinger <alex.koeplinger@outlook.com>
Thu, 11 Apr 2019 09:08:25 +0000 (11 11:08 +0200)
committerGitHub <noreply@github.com>
Thu, 11 Apr 2019 09:08:25 +0000 (11 11:08 +0200)
treeca422f48a8ca8bcc6c1ecddfbf647ba7a55bcb06
parent4eb4173b57af5c2403f2b68170229768a44f7e2d
[cil-strip] Fix reading of undefined NativeType values in old Cecil (#13954)

cil-strip crashed when processing this method: https://github.com/mono/corefx/blob/f54e64b341a7b114c3502e197b46670cacb28639/src/Microsoft.CSharp/tests/DefaultParameterTests.cs#L88

It uses `MarshalAs((UnmanagedType)2000)`, i.e. an undefined value for the native type. The old Cecil embedded in cil-strip tried to read more than one byte which blows up in this case.

Upstream Cecil just reads a single byte:
https://github.com/jbevain/cecil/blob/1b79b96d29f1e8e9ba832191b1b42ea9cb750d20/Mono.Cecil/AssemblyReader.cs#L3700-L3703

Fixes https://github.com/mono/mono/issues/13639
mcs/tools/cil-strip/Mono.Cecil.Signatures/SignatureReader.cs