You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bug in the following line
int v = (b[ptr] & 255) + (b[ptr + 1] << 8) + ((b[ptr + 2] & 255) << 16) + (b[ptr + 3] << 24);
If b[prt+1] or b[ptr+3] is negative, << will preserve sign and the overall plus operation will corrupt. Float values like 123.456f will be incorrectly decoded.
_decode64Bits()'s logic is correct.
The text was updated successfully, but these errors were encountered:
marsqing
changed the title
_decode32Bits() bug in ProtobufParser
[protobuf] _decode32Bits() bug in ProtobufParser
May 3, 2017
Thanks! I added a test (and slightly improved one for double too) to catch this, fixed.
Wonder how I didn't notice it; bug is kind of obvious looking at code and I'm familiar with sign extension.
I'll fix this for 2.7, 2.8 and master (2.9.0).
bug in the following line
int v = (b[ptr] & 255) + (b[ptr + 1] << 8) + ((b[ptr + 2] & 255) << 16) + (b[ptr + 3] << 24);
If b[prt+1] or b[ptr+3] is negative, << will preserve sign and the overall plus operation will corrupt. Float values like 123.456f will be incorrectly decoded.
_decode64Bits()'s logic is correct.
The text was updated successfully, but these errors were encountered: