Bug description
MessagePackReader.TryReadMapHeader throws OverflowException when hits a Map32 header whose count field exceeds int.MaxValue
Repro steps
var bytes = new byte[] { 0x91, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF };
var stream = new MemoryStream(bytes);
using var reader = new MessagePackStreamReader(stream);
await reader.ReadAsync(CancellationToken.None); // throws OverflowException
Expected behavior
TryReadMapHeader returns false and ReadAsync returns null or throws MessagePackSerializationException.
Actual behavior
What happened instead of what you expected.
System.OverflowException: Arithmetic operation resulted in an overflow.
at MessagePack.MessagePackReader.TryReadMapHeader(Int32& count)
at MessagePack.MessagePackReader.TrySkipNextMap()
at MessagePack.MessagePackReader.TrySkip()
at MessagePack.MessagePackReader.TrySkip(Int32 count)
at MessagePack.MessagePackReader.TrySkipNextArray()
at MessagePack.MessagePackReader.TrySkip()
at MessagePack.MessagePackStreamReader.TryReadNextMessage(ReadOnlySequence`1& completeMessage)
at MessagePack.MessagePackStreamReader.ReadAsync(CancellationToken cancellationToken)
Reactions are currently unavailable
Bug description
MessagePackReader.TryReadMapHeader throws OverflowException when hits a Map32 header whose count field exceeds int.MaxValue
Repro steps
var bytes = new byte[] { 0x91, 0xDF, 0xFF, 0xFF, 0xFF, 0xFF }; var stream = new MemoryStream(bytes); using var reader = new MessagePackStreamReader(stream); await reader.ReadAsync(CancellationToken.None); // throws OverflowExceptionExpected behavior
TryReadMapHeader returns false and ReadAsync returns null or throws MessagePackSerializationException.
Actual behavior
What happened instead of what you expected.