From: Mark Adler Date: Wed, 29 Jul 2015 04:06:06 +0000 (-0700) Subject: Add comment about not using windowBits of 8 for deflate(). X-Git-Tag: 1.9.9-b1~793^2~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=381c580960962523bf4e25b5db3f9e2832f84c6b;p=thirdparty%2Fzlib-ng.git Add comment about not using windowBits of 8 for deflate(). (cherry picked from commit b56d1c62ee1ff9705026c94a780dd6e4577cda02) --- diff --git a/zlib.h b/zlib.h index d8b41dfc7..bf9063099 100644 --- a/zlib.h +++ b/zlib.h @@ -541,6 +541,14 @@ ZEXTERN int ZEXPORT deflateInit2 (z_stream *strm, compression at the expense of memory usage. The default value is 15 if deflateInit is used instead. + For the current implementation of deflate(), a windowBits value of 8 (a + window size of 256 bytes) is not supported. As a result, a request for 8 + will result in 9 (a 512-byte window). In that case, providing 8 to + inflateInit2() will result in an error when the zlib header with 9 is + checked against the initialization of inflate(). The remedy is to not use 8 + with deflateInit2() with this initialization, or at least in that case use 9 + with inflateInit2(). + windowBits can also be -8..-15 for raw deflate. In this case, -windowBits determines the window size. deflate() will then generate raw deflate data with no zlib header or trailer, and will not compute an adler32 check value.