On Friday, February 19, 2016 at 3:56:34 PM UTC-8, Josh Haberman wrote: > > Thanks a lot for tracking this down. For reference, here it is in our bug > tracker: https://github.com/google/protobuf/issues/1243 > > On Thursday, February 11, 2016 at 3:28:33 AM UTC-8, Ron Ben-Yosef wrote: >> >> Hi, >> >> I'm using the proto3 C++ library compiled in MSVC, and noticed some >> pretty strange behavior - using the JsonToBinaryString or >> JsonToBinaryStream functions, values in the upper half of the uint32 range >> get lost in the transition from JSON to binary. >> >> After some investigation, it seems the issue's root cause is in the >> MathUtil::Sign function (called from NumberConvertAndCheck, which is called >> from DataPiece::GenericConvert, which gets called >> from DataPiece::ToUint32...) >> >> >>
Actually, there's a more basic problem here: MathUtil::Sign should return 1 or -1 (if the number is positive or negative, respectively), not value or -value. This bug breaks the following conformance tests for C++ (the first two are broken for all languages because the C++ protobuf used by the conformance test can't parse a correct JSON response): JsonInput.Int32FieldMinFloatValue.JsonOutput JsonInput.Int32FieldMinValue.JsonOutput JsonInput.Int32FieldMinFloatValue.ProtobufOutput JsonInput.Int32FieldMinValue.ProtobufOutput -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
