Sitelet https://github.com/MessagePack-CSharp/MessagePack-CSharp/issues/1586
Skip to content

System.OverflowException is thrown when LZ4MessagePackSerializer.Deserialize #1586

Description

@Halfason

Bug description

Our team use LZ4MessagePackSerializer.Serialize to serialize objects to file.
And deserialize objects by using LZ4MessagePackSerializer.Deserialize.

But one day, when deserializing, an System.OverflowException is thrown.
Why doesn't it throw the exception when serializing and saving?

Repro steps

  using (Stream stream = File.OpenRead(fileName))
  {
      stream.Seek(0, SeekOrigin.Begin);
      var localFileData = LZ4MessagePackSerializer.Deserialize<T>(stream); //object
  }

Expected behavior

no exceptions are thrown.

Actual behavior

one System.OverflowException is thrown.

  • Version used: 1.9.0.0
  • Runtime: .NET Framework 4.5.2

Additional context

Exception Stacktrace:

System.OverflowException: 算术运算导致溢出。
在 MessagePack.LZ4.LZ4Codec.CheckArguments(Byte[] input, Int32 inputOffset, Int32 inputLength, Byte[] output, Int32 outputOffset, Int32 outputLength)
在 MessagePack.LZ4.LZ4Codec.Decode64Unsafe(Byte[] input, Int32 inputOffset, Int32 inputLength, Byte[] output, Int32 outputOffset, Int32 outputLength)
在 MessagePack.LZ4MessagePackSerializer.DeserializeCore[T](ArraySegment`1 bytes, IFormatterResolver resolver)
在 MessagePack.LZ4MessagePackSerializer.Deserialize[T](Stream stream, IFormatterResolver resolver, Boolean readStrict)

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