RFR: 8341944: The zlib library no longer requires dummy byte for raw inflate [v2]
Volker Simonis
simonis at openjdk.org
Tue Oct 15 20:32:14 UTC 2024
On Fri, 11 Oct 2024 15:16:50 GMT, Eirik Bjørsnøs <eirbjo at openjdk.org> wrote:
>> Please review this cleanup PR which removes overrides of `InflaterInputStream.fill` in `ZipFileInflaterInputStream` and `ZipFileSystem::getInputStream`. Associated boolean fields used to track `eof` are also removed.
>>
>> These overrides exist to provide zlib with an extra dummy byte at the end of raw compressed streams (no wrapping):
>>
>>
>> // Override fill() method to provide an extra "dummy" byte
>> // at the end of the input stream. This is required when
>> // using the "nowrap" Inflater option.
>> protected void fill() throws IOException {
>>
>> However, zlib has not required such an extra dummy byte since 2003.
>>
>>
>> Changes in 1.2.0 (9 March 2003)
>> - New and improved inflate code
>> - Raw inflate no longer needs an extra dummy byte at end
>> ```
>>
>> The code in these overrides is effectively dead and removing it cleans up our code and reclaims weirdness dollars for our budget.
>>
>> Risk: I cannot imagine anyone is building OpenJDK with a 21 year old ZLIB. Please advise if this is the case or if any zlib fork in use still has this limitation.
>>
>> Testing: ZIP and ZIPFS tests run green locally. GHA also green. No tests are added or modified, this is a cleanup-only PR. Manually verified that the code is dead by injecting AssertionErrors.
>
> Eirik Bjørsnøs has updated the pull request incrementally with one additional commit since the last revision:
>
> Update Inflater and Deflater constructors taking 'nowrap' options to explain more clearly what this option does
>From the zlib-based libraries I've used ([zlib-chromium](https://chromium.googlesource.com/chromium/src/third_party/zlib), [zlib-cloudflare](https://github.com/cloudflare/zlib.git), [zlib-jkukunas](https://github.com/jtkukunas/zlib), and [zlib-ng](https://github.com/zlib-ng/zlib-ng.git)), none of them is based on a version earlier than 1.2.0 of [zlib-madler](https://github.com/madler/zlib.git). [zlib-cloudflare](https://github.com/cloudflare/zlib.git) is based on 1.2.8 and [zlib-ng](https://github.com/zlib-ng/zlib-ng.git) was forked from the original zlib 1.2.11, all others are based (or have integrated) at least 1.2.12
-------------
PR Comment: https://git.openjdk.org/jdk/pull/21467#issuecomment-2414951312
More information about the core-libs-dev
mailing list