Integrated: 7036144: GZIPInputStream readTrailer uses faulty available() test for end-of-stream

Archie Cobbs acobbs at openjdk.org
Wed Mar 20 15:04:31 UTC 2024


On Thu, 14 Dec 2023 20:15:39 GMT, Archie Cobbs <acobbs at openjdk.org> wrote:

> `GZIPInputStream`, when looking for a concatenated stream, relies on what the underlying `InputStream` says is how many bytes are `available()`. But this is inappropriate because `InputStream.available()` is just an estimate and is allowed (for example) to always return zero.
> 
> The fix is to ignore what's `available()` and just proceed and see what happens. If fewer bytes are available than required, the attempt to extend to another stream is canceled just as it was before, e.g., when the next stream header couldn't be read.

This pull request has now been integrated.

Changeset: d3f3011d
Author:    Archie Cobbs <acobbs at openjdk.org>
Committer: Jaikiran Pai <jpai at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/d3f3011d56267360d65841da3550eca79cf1575b
Stats:     111 lines in 2 files changed: 96 ins; 9 del; 6 mod

7036144: GZIPInputStream readTrailer uses faulty available() test for end-of-stream

Reviewed-by: jpai

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

PR: https://git.openjdk.org/jdk/pull/17113


More information about the core-libs-dev mailing list