Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
ChangeLog file for zlib

Changes in 1.3.2.1 (xx Feb 2026)
-
- deflateBound() now includes the preset-dictionary Adler-32 when the stream
header has not yet been emitted, so the bound holds when a dictionary is
provided after deflateBound() and before the first deflate()

Changes in 1.3.2 (17 Feb 2026)
- Continued rewrite of CMake build [Vollstrecker]
Expand Down
10 changes: 9 additions & 1 deletion deflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,15 @@ z_size_t ZEXPORT deflateBound_z(z_streamp strm, z_size_t sourceLen) {
wraplen = 0;
break;
case 1: /* zlib wrapper */
wraplen = 6 + (s->strstart ? 4 : 0);
/* A preset dictionary adds four bytes of its Adler-32 right after
the two-byte header. This can happen if a dictionary was already
provided (strstart is then non-zero), or if deflateBound() was
called before deflateSetDictionary() and the header has not yet
been emitted (status is still INIT_STATE, as no data has been
compressed). Include the four bytes in the latter case as well,
so the returned bound covers the documented use of allocating an
output buffer for a single-pass deflate(). */
wraplen = 6 + (s->strstart || s->status == INIT_STATE ? 4 : 0);
break;
#ifdef GZIP
case 2: /* gzip wrapper */
Expand Down