On Tue, 2 Nov 2021 09:54:38 GMT, Ravi Reddy <rre...@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()

Hello All .

Thanks for reviewing these changes. 
While testing ZipOutputStream:closeEntry(), I have found the same infinite loop 
issue is reproducible. Since closeEntry() does internally close the deflater , 
even though the documentation does not specify it, I think it should be fine to 
give the similar fix in closeEntry() of ZipOutputStream as well.  So there are 
total of three places where we should close deflater before throwing an 
exception.
1.GZipOutputStream:finish()
2.DeflaterOutputStream:close()
3.ZipOutputStream:closeEntry()

I have created a CSR explaining the changes: 
https://bugs.openjdk.java.net/browse/JDK-8276305

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

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

Reply via email to