Github user asuhan commented on a diff in the pull request:

    https://github.com/apache/thrift/pull/1326#discussion_r132613779
  
    --- Diff: lib/cpp/src/thrift/transport/TBufferTransports.cpp ---
    @@ -361,9 +361,13 @@ void TMemoryBuffer::ensureCanWrite(uint32_t len) {
       }
     
       // Grow the buffer as necessary.
    -  uint32_t new_size = bufferSize_;
    +  uint64_t new_size = bufferSize_;
       while (len > avail) {
         new_size = new_size > 0 ? new_size * 2 : 1;
    +    if (new_size > std::numeric_limits<uint32_t>::max()) {
    --- End diff --
    
    Basically, if we only go through powers of 2 when resizing (which looks to 
be the case), the buffer can only grow to 2GB since the maximum value of 
`uint32_t` is one short of 4GB.  


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to