Skip to content
This repository has been archived by the owner on Jun 24, 2024. It is now read-only.

Some zlib versions fail the DefaultDeflateCompatibilityWindow compatability test #179

Open
Adam- opened this issue Sep 12, 2021 · 2 comments

Comments

@Adam-
Copy link

Adam- commented Sep 12, 2021

The new DefaultDeflateCompatibilityWindow().isCompatible() test fails on many Linux distros currently, including: Debian 10, 11, Fedora 32, and Arch, however passes on at least Ubuntu 18.0.4 and 20.04. Tested on OpenJDK 11. This is due to a change in zlib:

commit 43bfaba3d718a27c1b137b1d1aa90d9427ab4a4f
Author: Mark Adler <[email protected]>
Date:   Sun Aug 2 00:02:07 2015 -0700

    Align deflateParams() and its documentation in zlib.h.

    This updates the documentation to reflect the behavior of
    deflateParams() when it is not able to compress all of the input
    data provided so far due to insufficient output space.  It also
    assures that data provided is compressed before the parameter
    changes, even if at the beginning of the stream.

 deflate.c |  3 +--
 zlib.h    | 38 ++++++++++++++++++++++++++------------
 2 files changed, 27 insertions(+), 14 deletions(-)

which is present in zlib v1.2.9, v1.2.10, and v1.2.11.

The original behavior was restored upstream in the develop branch in

commit f9694097dd69354b03cb8af959094c7f260db0a1
Author: Mark Adler <[email protected]>
Date:   Mon Jan 16 09:49:35 2017 -0800

    Permit a deflateParams() parameter change as soon as possible.

    This commit allows a parameter change even if the input data has
    not all been compressed and copied to the application output
    buffer, so long as all of the input data has been compressed to
    the internal pending output buffer. This also allows an immediate
    deflateParams change so long as there have been no deflate calls
    since initialization or reset.

which is unreleased - however Ubuntu is manually patching zlib with it in at least 18.04 and 20.04 - which is why those work.

We have additionally discovered disabling caching on the deflate compressor in DefaultDeflateCompatibilityWindow fixes this, too, eg:

    DeflateCompressor compressor = new DeflateCompressor();
    compressor.setCaching(false);

however I don't know if this is a safe change to make.

@Adam-
Copy link
Author

Adam- commented Apr 6, 2022

We have a commit which works around this issue by avoiding caching compressors if this zlib bug is present, if anyone else is experiencing the same problem: runelite@d394be0

@hamid97m
Copy link

It's fixed in my PR

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants