Skip to content

Error while unpacking message containing an empty dict #92

@Tinche

Description

@Tinche

So, while playing around with the Unity build, I've noticed an error (InvalidOperationException: This unpacker is located in the tail.) while decoding a valid MsgPack payload (at least I believe it's valid).

Here's the hex representation of a valid message: 82A17481A17404A46461746180

{
  "t": {
    "t": 4
  },
  "data": {}
}

Pretty sure this is a valid message, both according to http://msgpack-json-editor.com/, the Python MsgPack implementation and going over it using the MsgPack spec.

A snippet to reproduce:

public static byte[] StringToByteArray(string hex) {
    return Enumerable.Range(0, hex.Length)
          .Where(x => x % 2 == 0)
          .Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
          .ToArray();
}
MessagePackSerializer.Get<Dictionary<string, MessagePackObject> ().UnpackSingleObject(StringToByteArray("82A17481A17404A46461746180"));

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDetected as bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions