Affects Version/s: 0.13.0
Fix Version/s: None
Component/s: Ruby - Library
The range checks in https://github.com/apache/thrift/blob/master/lib/rb/lib/thrift/protocol/binary_protocol.rb are wrong.
Right now, if for example, someone accidentally writes an unsigned byte like 255, it would read as -1 on the other end of the line.
For write_byte, it should be:
For write_i64, it should be:
And i just noticed that for write_i16 there is no range check at all.
It is probably also better to put the calculated min/max values into consts. I did a quick benchmark:
Here is the code:
If PR's are welcome i'm more than happy to provide one.