Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
UnmarshalStream: Fixed two off-by-one errors in unmarshalInt #1338
While working on fixing issue #1329, I discovered something tangentially related that I think is a tiny bug and can be easily fixed. MRI's
I think that
Here is the code I used to demonstrate the difference between MRI 2.0.0p0 and JRuby:
# MRI returns 0 for each, JRuby says marshal data is too short puts Marshal.load("\x04\x08i\x05") puts Marshal.load("\x04\x08i\xFB")
I suppose this isn't too important, because the number 0 will probably be marshaled as the 0x00 byte instead of 0xFB or 0x05, but if MRI treats those bytes as representing 0 then I don't think it is helpful for JRuby to raise an exception (or to try to construct an integer by reading 5 bytes from the stream).
I am happy to do any more investigating or documentation that is needed. Should I write a test for this? If so, where should I put it?