Jens Geyer created THRIFT-6356:
----------------------------------

             Summary: Python C extension sizes the first container allocation 
from the declared count when the message is buffered whole
                 Key: THRIFT-6356
                 URL: https://issues.apache.org/jira/browse/THRIFT-6356
             Project: Thrift
          Issue Type: Bug
          Components: Python - Library
            Reporter: Jens Geyer


{{initialContainerSize()}} in the fastbinary C extension held the first 
allocation of a list, set or tuple to {{kMaxInitialContainerSize}} only when 
the decode buffer could not report how many bytes were left. For a message 
buffered whole, the first allocation was sized from the declared element count. 
Follow-up to THRIFT-6169.

Fixed on master by 
[420e9ca37|https://github.com/apache/thrift/commit/420e9ca37d820cad3796d01e3219b3ed22c3ba4b]:
 the same ceiling applies on every path. The first allocation is the smallest 
of the declared count, the bytes remaining and {{kMaxInitialContainerSize}}, 
and a larger container grows as its elements are read.

Reported by Sylwester Lachiewicz.

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



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

Reply via email to