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>
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>
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>
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
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