localshred/protobuf — pull request #200 by localshred (2014-06-30 01:45:49+00:00)
Title: Enums should be able to have negative values

When a protobuf is defined such that it contains an enum with a negative value, we can encode it but not decode it. (I'm not sure whether the error occurs in encoding or decoding, but that might be interesting to know.)

Repro script here: https://gist.github.com/ismith/b17e9b31d696195169df

Note that although discouraged, the spec does allow enums to have negative values: "Enumerator constants must be in the range of a 32-bit integer. Since enum values use varint encoding on the wire, negative values are inefficient and thus not recommended." from https://developers.google.com/protocol-buffers/docs/proto

(Looks like at least one other protobuf implementation has run into this, too: https://github.com/dcodeIO/ProtoBuf.js/issues/34)