RFR: 8283411: InflaterInputStream holds on to a temporary byte array of 512 bytes

Alan Bateman alanb at openjdk.java.net
Sun Mar 20 13:56:26 UTC 2022


On Sun, 20 Mar 2022 04:24:07 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:

> Can I please get a review of this change which handles https://bugs.openjdk.java.net/browse/JDK-8283411?
> 
> The commit here moves the temporary byte array from being a member of the class to a local variable within the `skip` method which is the only place where it is used as a temporary buffer.
> 
> tier1, tier2, tier3 tests have been run successfully with this change.

src/java.base/share/classes/java/util/zip/InflaterInputStream.java line 206:

> 204:         int max = (int)Math.min(n, Integer.MAX_VALUE);
> 205:         int total = 0;
> 206:         byte[] b = new byte[512];

n may be less than 512 so maybe the temporary array can be of length Math.min(max, 512).

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

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


More information about the core-libs-dev mailing list