Jens Geyer created THRIFT-6223:
----------------------------------

             Summary: c_glib: thrift_transport_countConsumedMessageBytes 
refuses a read that uses exactly the remaining budget
                 Key: THRIFT-6223
                 URL: https://issues.apache.org/jira/browse/THRIFT-6223
             Project: Thrift
          Issue Type: Bug
          Components: C glib - Library
            Reporter: Jens Geyer


{{thrift_transport_countConsumedMessageBytes()}} 
({{lib/c_glib/src/thrift/c_glib/transport/thrift_transport.c}}) only decrements 
while {{remainingMessageSize_ > numBytes}}. Consuming exactly the remaining 
amount takes the error branch, sets the budget to 0 and reports "MaxMessageSize 
reached" -- although {{thrift_transport_checkReadBytesAvailable()}} in the same 
file accepts that read ({{remainingMessageSize_ < numBytes}} is the failing 
case there).

The C++ ({{TTransport.h}}), Java and netstd ({{TEndpointTransport}}) 
implementations all use {{>=}}.

A side effect: binding the budget to a frame with {{updateKnownMessageSize()}}, 
as the other libraries do, cannot be done in c_glib as long as this stands, 
because a zero-length frame would be refused.

Suggested fix: {{>=}}, with a test that consumes exactly the configured maximum.

_Drafted with AI assistance (Claude Opus 5); reviewed and filed by Jens Geyer._



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to