RFR: 8292327: java.io.EOFException in InflaterInputStream after JDK-8281962 [v3]

Volker Simonis simonis at openjdk.org
Tue Aug 16 17:34:58 UTC 2022


> The problem is that after [JDK-8281962](https://bugs.openjdk.org/browse/JDK-8281962) we call `fill()` unconditionally (and before calling `Inflater::inflate()`) in `InflaterInputStream::read()` if `Inflater::needsInput()` is true. This misses the case where the native inflater has consumed all its input (i.e. `Inflater::needsInput()` returns true) but hasn't managed to write all the inflated data into the output buffer (e.g. because it was to small). In rare cases, there might be now more input available (i.e. calling `InflaterInputStream::fill()` will throw an `EOFException`) but we still have to call `Inflater::inflate()` to consume the buffered output from the underlying native inflater until inflation stops. 
> 
> The documentation of the `inflate()` method in `zlib.h` mentions this explicitely:
> 
>> "If `inflate()` returns `Z_OK` and with zero `avail_out`, it must be called again after making room in the output buffer because there might be more output pending."

Volker Simonis has updated the pull request incrementally with one additional commit since the last revision:

  Changed the payload to a more innocent version

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

Changes:
  - all: https://git.openjdk.org/jdk/pull/9881/files
  - new: https://git.openjdk.org/jdk/pull/9881/files/3bbfacf1..35d80f6c

Webrevs:
 - full: https://webrevs.openjdk.org/?repo=jdk&pr=9881&range=02
 - incr: https://webrevs.openjdk.org/?repo=jdk&pr=9881&range=01-02

  Stats: 23 lines in 1 file changed: 7 ins; 3 del; 13 mod
  Patch: https://git.openjdk.org/jdk/pull/9881.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/9881/head:pull/9881

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


More information about the core-libs-dev mailing list