On Thu, 14 Dec 2023 20:15:39 GMT, Archie Cobbs <aco...@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. test/jdk/java/util/zip/GZIP/GZIPInputStreamAvailable.java line 37: > 35: public static void main(String [] args) throws IOException { > 36: > 37: // Create gz data Perhaps expand the comment to explain that you are creating a concatenated stream? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/17113#discussion_r1427291799