New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serializer.Deserialize hangs permanently #479

Open
Metalnem opened this Issue Dec 25, 2018 · 0 comments

Comments

Projects
None yet
1 participant
@Metalnem
Copy link

Metalnem commented Dec 25, 2018

Serializer.Deserialize method hangs permanently when trying to deserialize data from one small (16-byte) data stream. Here's the full program to reproduce it:

using System.IO;
using ProtoBuf;

namespace protobuf_net.Run
{
  [ProtoContract]
  public class Person
  {
    [ProtoMember(1)] public int Id { get; set; }
    [ProtoMember(2)] public string Name { get; set; }
    [ProtoMember(3)] public Address Address { get; set; }
  }

  [ProtoContract]
  public class Address
  {
    [ProtoMember(1)] public string Line1 { get; set; }
    [ProtoMember(2)] public string Line2 { get; set; }
  }

  public class Program
  {
    public static void Main(string[] args)
    {
      var bytes = new byte[]
      {
        0xF2, 0xF2, 0xF2, 0x02,
        0xF2, 0xFF, 0xFF, 0xFF,
        0xFF, 0xF2, 0xF2, 0xF2,
        0xF2, 0x01, 0xF2, 0x00
      };

      using (var stream = new MemoryStream(bytes))
      {
        Serializer.Deserialize<Person>(stream);
      }
    }
  }
}

Found via SharpFuzz.

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