Jens Geyer created THRIFT-6281:
----------------------------------

             Summary: Go: TFramedTransport.Flush writes frames larger than the 
configured MaxFrameSize
                 Key: THRIFT-6281
                 URL: https://issues.apache.org/jira/browse/THRIFT-6281
             Project: Thrift
          Issue Type: Bug
          Components: Go - Library
            Reporter: Jens Geyer


Found while working on THRIFT-6262, which does the same for 
{{THeaderTransport}} (PR #3860).

{{TFramedTransport.Flush}} ({{lib/go/thrift/framed_transport.go}}) checks the 
frame against {{math.MaxUint32}} only. The transport's configured 
{{MaxFrameSize}}, which {{readFrameHeader}} applies to every frame it reads, is 
not applied to the frames it writes.

Measured on master with {{MaxFrameSize: 1024}}:
* {{Flush}} of a 2048-byte frame returns nil and writes 2052 bytes.
* A {{TFramedTransport}} holding the same configuration refuses that frame with 
"Incorrect frame size (2048)".

h2. Suggested

Check the frame against {{GetMaxFrameSize()}} before writing the length, as 
{{THeaderTransport.Flush}} now does, and refuse it with nothing written.

_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