[ https://issues.apache.org/jira/browse/THRIFT-4138?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16756749#comment-16756749 ]
James E. King III commented on THRIFT-4138: ------------------------------------------- This broke TJSONProtocol's ability to read in some negative values. For example if the sequence ID becomes negative (which is allowed - it's a signed 32-bit int), it is read into an unsigned 64-bit int, which corrupts it.: {noformat} Thread 2 "TestServer" hit Breakpoint 1, apache::thrift::protocol::TJSONProtocol::readJSONInteger<unsigned long> (this=0x7ffff0001610, num=@0x7ffff5262938: 1) at src/thrift/protocol/TJSONProtocol.cpp:868 868 num = fromString<NumberType>(str); (gdb) p str $54 = "-2147483648" (gdb) s apache::thrift::protocol::(anonymous namespace)::fromString<unsigned long> (s="-2147483648") at src/thrift/protocol/TJSONProtocol.cpp:846 846 T fromString(const std::string& s) { (gdb) n 848 std::istringstream str(s); (gdb) p s $55 = "-2147483648" (gdb) n 849 str.imbue(std::locale::classic()); (gdb) n 850 str >> t; (gdb) n 851 if (str.bad() || !str.eof()) (gdb) p t $56 = 18446744071562067968 {noformat} So unfortunately we replaced undefined behavior with incorrect behavior... I caught this as part of THRIFT-4405. > Fix remaining undefined behavior invalid vptr casts in C++ library > ------------------------------------------------------------------ > > Key: THRIFT-4138 > URL: https://issues.apache.org/jira/browse/THRIFT-4138 > Project: Thrift > Issue Type: Sub-task > Components: C++ - Library > Reporter: Jens Geyer > Assignee: Jim Apple > Priority: Major > Fix For: 0.11.0 > > -- This message was sent by Atlassian JIRA (v7.6.3#76005)