David Li created ARROW-11937:
--------------------------------

             Summary: [C++] GZip codec hangs if flushed twice
                 Key: ARROW-11937
                 URL: https://issues.apache.org/jira/browse/ARROW-11937
             Project: Apache Arrow
          Issue Type: Bug
          Components: C++
    Affects Versions: 3.0.0
            Reporter: David Li
            Assignee: David Li
             Fix For: 4.0.0


{code:java}
    // "If deflate returns with avail_out == 0, this function must be called
    //  again with the same value of the flush parameter and more output space
    //  (updated avail_out), until the flush is complete (deflate returns
    //  with non-zero avail_out)."
    return FlushResult{bytes_written, (bytes_written == 0)}; {code}
But contrary to the comment, we're checking bytes_written. So if we flush 
twice, the second time, we won't write any bytes, but we'll erroneously 
interpret that as zlib asking for a larger buffer, rather than zlib telling us 
there's no data to decompress. Then we'll enter a loop where we keep doubling 
the buffer size forever, hanging the program.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to