RFR: 8278794: Infinite loop in DeflaterOutputStream.finish()

Sean Coffey coffeys at openjdk.java.net
Wed Mar 16 12:03:46 UTC 2022


On Sun, 13 Mar 2022 14:08:57 GMT, Ravi Reddy <rreddy at openjdk.org> wrote:

> Hi All,
> 
> This review request contains fix for infinite loop issue in DeflaterOutputStream.finish() in an exception scenario.
> 1. The issue is with 'finished' flag not getting set to correct value when there is an IOException in 
>     DeflaterOutputStream.finish() which will result in Infinite loops for next write operations on the same deflater.
> 2. Tighten the condition(to close deflater) in ZipOutputStream using an already existing 'finish' flag in Deflater class.
> 3. Added Inflater exception scenarios also to the test case, renaming test case to CloseInflaterDeflaterTest.java from CloseDeflaterTest.java
> 
> Thanks,
> Ravi

Looks like a good approach to solve reported issue.

test/jdk/java/util/zip/CloseInflaterDeflaterTest.java line 58:

> 56:         }
> 57:         @Override
> 58:         public void write(byte b[]) throws IOException {}

Let's be consistant with style and use "byte[] b" 

Same with line 70

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

Marked as reviewed by coffeys (Reviewer).

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


More information about the core-libs-dev mailing list