mafintosh / mafintosh/protocol-buffers
negative int64 values handling is not compatible with reference Protobuf encoding
- Dominant language
- JavaScript
- Stars
- 760
- Forks
- 75
- PR merge metrics
- No merged PRs in 30d
Description
#14 by @yhahn had a nice int64 decoding/encoding fix, but the resulting byte sequence is not compatible with how it's handled in the reference Protobuf implementation. `int64` are cast into `uint64` using [Two's complement](http://en.wikipedia.org/wiki/Two%27s_complement), so when decoding, each byte should be flipped, and `1` added to the resulting number.
Here's how I hacked this together in my `pbf` implementation for decoding, and it seems to work: https://github.com/mapbox/pbf/blob/int64/index.js#L119-L120
Contributor guide
No contributing guide indexed for this repository
Research direction
Compare the repository's negative int64 encoding and decoding with the reference Protobuf behavior and the linked pbf implementation at index.js#L119-L120. Confirm that negative int64 values produce byte sequences compatible with reference Protobuf encoding.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100