TokTok / hs-msgpack-binary

Haskell implementation of MessagePack / msgpack.org
http://msgpack.org/
Other
16 stars 10 forks source link

Fix MessagePack Integer implementation #16

Closed SX91 closed 7 years ago

SX91 commented 7 years ago

MessagePack spec declares Int as [-(2^63-1), 2^64-1] and encodes negatives (< 0) and non-negatives (>= 0) differently.

data-msgpack implementation used Int64 to store both negative and positive values, which in result caused values > 2^63 to be encoded as negative values.

Your tests didn't fail because Word64 -> Int64 -> Word64 would convert just fine. But any other MessagePack implementations would read a negative value (or fail, if positive is expected).

Fixes https://github.com/TokTok/hs-msgpack/issues/15.

SX91 commented 7 years ago

Please review. I've committed all the required changes.

SX91 commented 7 years ago

Done.