25 Commits
Author SHA1 Message Date
Jens GeyerandClaude Opus 4.8 7f4f67cbff Reject an empty or out-of-range number in the C++ JSON protocol
Client: cpp

fromString() returned a value that extraction had never assigned when the
numeric token was empty, and returned a clamped value when the token was
outside the target type's range, because it tested only bad() and eof(). It
now value-initialises the result and tests fail(), so an empty token and an
out-of-range value both raise a TProtocolException through readJSONInteger()
and readJSONDouble() instead. Two cases in JSONProtoTest cover them.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-28 01:15:49 +01:00
Jens GeyerandClaude Opus 5 c42a148f32 Measure JSON field size against the configured maximum
Client: cpp

readJSONString() and readJSONNumericChars() passed their running byte count to
checkReadBytesAvailable(), which compares against the message size still
remaining rather than the configured maximum. On a transport whose read() also
draws that budget down, the same bytes are accounted for twice: once as they are
consumed and once as the running count. TZlibTransport::read() does exactly
that, so JSON over zlib rejects a string once it passes roughly half of whatever
was left of the budget when the field started, and since nothing resets the
budget between fields the threshold keeps shrinking as the message goes on. With
a 1 KB maximum a 768-byte string is cut off at 511 bytes.

Measure the running count against the configured maximum instead, which is what
the Java, netstd, Delphi, Go and Python readers already do. Every transport that
checks the budget without drawing it down -- socket, SSL, buffered, framed,
memory, HTTP -- behaves exactly as before, since for those the remaining size
never moves off the maximum during a read.

Tests both directions: JSONProtoTest covers it transport-agnostically with a
stand-in that draws the budget down as TZlibTransport does, and ZlibTest covers
the real composition.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-27 23:09:45 +02:00
Jens GeyerandClaude Sonnet 5 4a9b2546c5 Bound TJSONProtocol string and number reads by MaxMessageSize
Client: cpp

readJSONString() and readJSONNumericChars() consume quote-delimited and
character-by-character input with no declared length, so unlike the
length-prefixed protocols they had no size gate before growing the value.
Check the running byte count against the configured MaxMessageSize as the
value grows, so a single JSON string or numeric literal is bounded by the
configured message-size limit the way length-prefixed reads already are.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-07-26 22:43:58 +02:00
Hasnain Lakhani ce6139bc44 [cpp] Adjust base64 padding parsing in TJSONProtocol 2025-06-06 21:47:49 +02:00
Hasnain Lakhani b0252a9b43 Throw exception instead of asserting in TJSONProtocol::readByte
Client: cpp
Patch: Hasnain Lakhani
2025-05-24 01:14:21 +02:00
Carel Combrink 4035ecca56 THRIFT-5865: Fix TBinayProtocol with list<UUID>
Client: cpp
Patch: Carel Combrink

This closes #3136
2025-05-16 21:20:28 +02:00
CJCombrink 4b90909ddd THRIFT-5773 Strong UUID wrapper for C++
Client: cpp/CMakeLists.txt
Patch: Carel Combrink

This closes #2958
2024-06-17 22:26:56 +02:00
CJCombrink 1d886ca4af THRIFT-5772: UUID support for c++ #2952
Client: cpp
Patch: CJCombrink

This closes #2952
2024-04-07 22:41:58 +02:00
zeshuai007 86396c6880 Add testcase for other condition judgment in the readJSONDouble function
Client: cpp
Patch: zeshuai007 <51382517@qq.com>

This closes #2080
2020-03-31 23:06:36 +02:00
cyy 316723add4 remove stdcxx namespace and use std directly 2019-01-07 08:11:37 -05:00
James E. King, III 82ae9575cd THRIFT-2221: detect C++11 and use std namespace for memory operations (smart_ptr)
Client: C++

This closes #1328
2017-08-10 13:27:21 -04:00
James E. King, III e1832c3543 THRIFT-3622: remove auto_ptr use in the codebase because it is deprecated
Client: C++

This closes #1183
2017-02-10 13:03:10 -05:00
James E. King, III 7edc8faefd THRIFT-3873: fix various compiler warnings and overflow errors
THRIFT-3847: change VERSION to PACKAGE_VERSION to avoid conflicts with third party or OS headers

This closes #1128
2017-01-20 10:12:06 -05:00
Wang Yaofu 0433d171f6 THRIFT-3636 Double precision is not fully preserved in C++ TJSONProtocol
Client: C++
Patch: Wang Yaofu

This closes #870
2016-02-17 23:55:28 +09:00
Konrad Grochowski a84e139215 THRIFT-2411 - C++: Fixed support for UTF-16 encoding in JSON protocol
Client: C++
Patch: Phongphan Phuttha <phongphan@acm.org>

Support unicode-encoded character including UTF-16 surrogate pair which
allow extended character that is not in Basic Multilingual Plane.

This closes #648
2015-10-16 11:36:36 +02:00
Claudius Heine 8f11f52341 THRIFT-3215 Replaces "throw new" in TJSONProtocol with a "throw" (+ testcase)
Sponsored-by: Roger Meier <r.meier@siemens.com>
Signed-off-by: Claudius Heine <ch@denx.de>
2015-07-08 11:26:51 +02:00
Claudius Heine 5ef662b904 THRIFT-406 Convert C++ Test to Boost::Test
Sponsored-by: Roger Meier <r.meier@siemens.com>
Signed-off-by: Claudius Heine <ch@denx.de>
2015-06-29 19:49:16 +10:00
Konrad Grochowski 16a23a6618 THRIFT-2729: C++ - .clang-format created and applied
Client: C++
Patch: Konrad Grochowski

make style command added
2014-11-18 11:39:10 +01:00
Konrad Grochowski 240120c843 Revert "THRIFT-2729: C++ - .clang-format created and applied"
This reverts commit 74260aa909.
2014-11-18 11:33:31 +01:00
Konrad Grochowski 74260aa909 THRIFT-2729: C++ - .clang-format created and applied
Client: C++
Patch: Konrad Grochowski

make style command added
2014-11-18 10:02:08 +01:00
Roger Meier 22888ce3a8 THRIFT-2352 msvc failed to compile thrift tests
Patch: Sergei Nikulov & Roger Meier
2014-02-09 11:31:02 +01:00
Jake Farrell 5d02b80e9c Thrift-2029:Port C++ tests to Windows
Client: cpp
Patch: Ben Craig

Updates cpp tests to work with windows and c++11
2014-01-07 21:42:01 -05:00
Roger Meier 49ff8b123a THRIFT-1552 Include paths for c/c++ should be prefixed with 'thrift/'
To ensure there are no include path collisions the C and C++ header
include paths should include 'thrift' as the root leaf. This will
prevent having to place /usr/include/thrift into the compilers include
header search path, which might otherwise result in the compiler
accidentally picking up headers that it shouldn't.

e.g. #include <foo/bar.h> should be #include <thrift/foo/bar.h>

Change-Id: I48f2b0f549bda0fc81e85506ac857adc800b98a1

git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1325674 13f79535-47bb-0310-9956-ffa450edef68
2012-04-13 09:12:31 +00:00
Christian Lavoie cbf87cb89c THRIFT-916: Commit THRIFT-916_fix_no-overflow.patch -- remove overflow coming from a few constants.
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1039885 13f79535-47bb-0310-9956-ffa450edef68
2010-11-28 14:34:26 +00:00
David Reiss 351e22b52a THRIFT-503. cpp: Move the tests built by "make check" under lib/cpp
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@991246 13f79535-47bb-0310-9956-ffa450edef68
2010-08-31 16:51:19 +00:00