RFR: 8193682: Infinite loop in ZipOutputStream.close() [v4]

Alan Bateman alanb at openjdk.java.net
Tue Oct 26 12:30:21 UTC 2021


On Tue, 26 Oct 2021 06:30:39 GMT, Ravi Reddy <rreddy at openjdk.org> wrote:

>> Hi all,
>> 
>> Please review this fix for Infinite loop in ZipOutputStream.close().
>> The main issue here is when ever there is an exception during close operations on GZip we are not setting the deflator to a finished state which is leading to an infinite loop when we try writing on the same GZip instance( since we use while(!def.finished()) inside the write operation).
>> 
>> Thanks,
>> Ravi
>
> Ravi Reddy has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8193682 : Infinite loop in ZipOutputStream.close()

src/java.base/share/classes/java/util/zip/DeflaterOutputStream.java line 247:

> 245:                if (usesDefaultDeflater)
> 246:                  def.end();
> 247:                throw e;

The formatting is a bit wonky but I think this version is the best so far. It does mean that the stream state is undefined when close throws but this has always been the case.

-------------

PR: https://git.openjdk.java.net/jdk/pull/5522


More information about the core-libs-dev mailing list