Proposed fix for JDK-8028804 (Deflater.deflateBytes() may produce corrupted output on Deflater level/strategy change)

Alan Bateman Alan.Bateman at
Tue Nov 26 13:55:43 UTC 2013

On 26/11/2013 13:27, Thomas Stüfe wrote:
> :
> The real problem is that zlib deflateParams(), unlike zlib deflate(), does
> not handle output-buffer-too-small correctly. The workaround is to fully
> flush the stream before calling deflateParams(), so that the deflate() call
> inside deflateParams() becomes a noop.
I think you're right but I wonder if this is something that needs to be 
brought upstream to the zlib project in order to get the support in 
deflateParams (or a new function).

My concern with having a dependency on a patched zlib is that I don't 
know how it will work when using the system libz (the default on Mac, or 
on Linux if you configure with --with-zlib=system).


More information about the core-libs-dev mailing list