[Zlib-devel] stored-block size limit?
Mark Adler
madler at alumnus.caltech.edu
Tue Apr 9 20:43:00 EDT 2002
On Tuesday, April 9, 2002, at 10:13 AM, Jean-loup Gailly wrote:
> Ok. Can you suggest specific patches, to both the text and the code?
I have sent you patches to add two functions, deflateBound() and
compressBound(), and to correct the comments in zlib.h.
> That's indeed a bug. I'll look into it unless you can send patches for
> this one too.
My recommendation for now is to document the behavior, thereby
transforming the bug into a feature. :-)
If you want to fix it, my other suggestion was to force memLevel to be
no greater than windowBits - 6 in deflateInit2(). This circumvents the
bug, though it would have some impact on compression compared to the
unforced settings.
if (memLevel > windowBits - 6)
memLevel = windowBits - 6;
It would be harder to fix this without forcing memLevel. An alternative
might be to force windowBits instead, but keep two different
windowBits. One to define a window memory that's large enough to keep
the data around to decide on a stored block, and the other to limit the
distances to the windowBits provided by the user.
mark
More information about the Zlib-devel
mailing list