FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

TryReadMapHeader throws OverflowException · Issue #2276 · MessagePack-CSharp/MessagePack-CSharp · GitHub

TryReadMapHeader throws OverflowException #2276

Description

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL