facebook / fbthrift

Facebook's branch of Apache Thrift, including a new C++ server.
Apache License 2.0
2.55k stars 608 forks source link

Compact protocol map specification bug #542

Open terrelln opened 1 year ago

terrelln commented 1 year ago

https://www.internalfb.com/intern/staticdocs/thrift/docs/spec/protocol/data/#map-1

It states that:

Maps contain a variable encoded length followed by the key and value types encoded in a single byte. Next comes the payload which is encoded in a similar way to the Binary protocol.

Length Key Type Value Type Key 1 Value 1 ... Key n Value n
Variable 4-bit 4-bit Variable Variable   Variable Variable

However in the implementation, the byte containing the key type & value type is not present if the length is 0.