Skip to content

Commit a8a8e50

Browse files
committed
Update bundled zlib to 1.3.2
1 parent 5952777 commit a8a8e50

23 files changed

Lines changed: 1450 additions & 1011 deletions

src/Common/zlib/ChangeLog

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,57 @@
11

22
ChangeLog file for zlib
33

4+
Changes in 1.3.2 (17 Feb 2026)
5+
- Continued rewrite of CMake build [Vollstrecker]
6+
- Various portability improvements
7+
- Various github workflow additions and improvements
8+
- Check for negative lengths in crc32_combine functions
9+
- Copy only the initialized window contents in inflateCopy
10+
- Prevent the use of insecure functions without an explicit request
11+
- Add compressBound_z and deflateBound_z functions for large values
12+
- Use atomics to build inflate fixed tables once
13+
- Add definition of ZLIB_INSECURE to build tests with c89 and c94
14+
- Add --undefined option to ./configure for UBSan checker
15+
- Copy only the initialized deflate state in deflateCopy
16+
- Zero inflate state on allocation
17+
- Remove untgz from contrib
18+
- Add _z versions of the compress and uncompress functions
19+
- Vectorize the CRC-32 calculation on the s390x
20+
- Set bit 11 of the zip header flags in minizip if UTF-8
21+
- Update OS/400 support
22+
- Add a test to configure to check for a working compiler
23+
- Check for invalid NULL pointer inputs to zlib operations
24+
- Add --mandir to ./configure to specify manual directory
25+
- Add LICENSE.Info-Zip to contrib/minizip
26+
- Remove vstudio projects in lieu of cmake-generated projects
27+
- Replace strcpy() with memcpy() in contrib/minizip
28+
29+
Changes in 1.3.1.2 (8 Dec 2025)
30+
- Improve portability to RISC OS
31+
- Permit compiling contrib/minizip/unzip.c with decryption
32+
- Enable build of shared library on AIX
33+
- Make deflateBound() more conservative and handle Z_STREAM_END
34+
- Add zipAlreadyThere() to minizip zip.c to help avoid duplicates
35+
- Make z_off_t 64 bits by default
36+
- Add deflateUsed() function to get the used bits in the last byte
37+
- Avoid out-of-bounds pointer arithmetic in inflateCopy()
38+
- Add Haiku to configure for proper LDSHARED settings
39+
- Add Bazel targets
40+
- Complete rewrite of CMake build [Vollstrecker]
41+
- Clarify the use of errnum in gzerror()
42+
- Note that gzseek() requests are deferred until the next operation
43+
- Note the use of gzungetc() to run a deferred seek while reading
44+
- Fix bug in inflatePrime() for 16-bit ints
45+
- Add a "G" option to force gzip, disabling transparency in gzread()
46+
- Improve the discrimination between trailing garbage and bad gzip
47+
- Allow gzflush() to write empty gzip members
48+
- Remove redundant frees of point list on error in examples/zran.c
49+
- Clarify the use of inflateGetHeader()
50+
- Update links to the RFCs
51+
- Return all available uncompressed data on error in gzread.c
52+
- Support non-blocking devices in the gz* routines
53+
- Various other small improvements
54+
455
Changes in 1.3.1 (22 Jan 2024)
556
- Reject overflows of zip header fields in minizip
657
- Fix bug in inflateSync() for data held in bit buffer

src/Common/zlib/README

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
ZLIB DATA COMPRESSION LIBRARY
22

3-
zlib 1.3.1 is a general purpose data compression library. All the code is
4-
thread safe. The data format used by the zlib library is described by RFCs
5-
(Request for Comments) 1950 to 1952 in the files
6-
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
7-
rfc1952 (gzip format).
3+
zlib 1.3.2 is a general purpose data compression library. All the code is
4+
thread safe (though see the FAQ for caveats). The data format used by the zlib
5+
library is described by RFCs (Request for Comments) 1950 to 1952 at
6+
https://datatracker.ietf.org/doc/html/rfc1950 (zlib format), rfc1951 (deflate
7+
format) and rfc1952 (gzip format).
88

99
All functions of the compression library are documented in the file zlib.h
1010
(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example
@@ -21,17 +21,17 @@ make_vms.com.
2121

2222
Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant
2323
<info@winimage.com> for the Windows DLL version. The zlib home page is
24-
http://zlib.net/ . Before reporting a problem, please check this site to
24+
https://zlib.net/ . Before reporting a problem, please check this site to
2525
verify that you have the latest version of zlib; otherwise get the latest
2626
version and check whether the problem still exists or not.
2727

28-
PLEASE read the zlib FAQ http://zlib.net/zlib_faq.html before asking for help.
28+
PLEASE read the zlib FAQ https://zlib.net/zlib_faq.html before asking for help.
2929

3030
Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
3131
issue of Dr. Dobb's Journal; a copy of the article is available at
32-
https://marknelson.us/posts/1997/01/01/zlib-engine.html .
32+
https://zlib.net/nelson/ .
3333

34-
The changes made in version 1.3.1 are documented in the file ChangeLog.
34+
The changes made in version 1.3.2 are documented in the file ChangeLog.
3535

3636
Unsupported third party contributions are provided in directory contrib/ .
3737

@@ -43,9 +43,9 @@ can be found at https://github.com/pmqs/IO-Compress .
4343

4444
A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
4545
available in Python 1.5 and later versions, see
46-
http://docs.python.org/library/zlib.html .
46+
https://docs.python.org/3/library/zlib.html .
4747

48-
zlib is built into tcl: http://wiki.tcl.tk/4610 .
48+
zlib is built into tcl: https://wiki.tcl-lang.org/page/zlib .
4949

5050
An experimental package to read and write files in .zip format, written on top
5151
of zlib by Gilles Vollant <info@winimage.com>, is available in the
@@ -69,9 +69,7 @@ Notes for some targets:
6969
- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
7070
other compilers. Use "make test" to check your compiler.
7171

72-
- gzdopen is not supported on RISCOS or BEOS.
73-
74-
- For PalmOs, see http://palmzlib.sourceforge.net/
72+
- For PalmOs, see https://palmzlib.sourceforge.net/
7573

7674

7775
Acknowledgments:
@@ -83,7 +81,7 @@ Acknowledgments:
8381

8482
Copyright notice:
8583

86-
(C) 1995-2024 Jean-loup Gailly and Mark Adler
84+
(C) 1995-2026 Jean-loup Gailly and Mark Adler
8785

8886
This software is provided 'as-is', without any express or implied
8987
warranty. In no event will the authors be held liable for any damages

src/Common/zlib/compress.c

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* compress.c -- compress a memory buffer
2-
* Copyright (C) 1995-2005, 2014, 2016 Jean-loup Gailly, Mark Adler
2+
* Copyright (C) 1995-2026 Jean-loup Gailly, Mark Adler
33
* For conditions of distribution and use, see copyright notice in zlib.h
44
*/
55

@@ -18,13 +18,19 @@
1818
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
1919
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
2020
Z_STREAM_ERROR if the level parameter is invalid.
21+
22+
The _z versions of the functions take size_t length arguments.
2123
*/
22-
int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,
23-
uLong sourceLen, int level) {
24+
int ZEXPORT compress2_z(Bytef *dest, z_size_t *destLen, const Bytef *source,
25+
z_size_t sourceLen, int level) {
2426
z_stream stream;
2527
int err;
2628
const uInt max = (uInt)-1;
27-
uLong left;
29+
z_size_t left;
30+
31+
if ((sourceLen > 0 && source == NULL) ||
32+
destLen == NULL || (*destLen > 0 && dest == NULL))
33+
return Z_STREAM_ERROR;
2834

2935
left = *destLen;
3036
*destLen = 0;
@@ -43,23 +49,36 @@ int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,
4349

4450
do {
4551
if (stream.avail_out == 0) {
46-
stream.avail_out = left > (uLong)max ? max : (uInt)left;
52+
stream.avail_out = left > (z_size_t)max ? max : (uInt)left;
4753
left -= stream.avail_out;
4854
}
4955
if (stream.avail_in == 0) {
50-
stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen;
56+
stream.avail_in = sourceLen > (z_size_t)max ? max :
57+
(uInt)sourceLen;
5158
sourceLen -= stream.avail_in;
5259
}
5360
err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH);
5461
} while (err == Z_OK);
5562

56-
*destLen = stream.total_out;
63+
*destLen = (z_size_t)(stream.next_out - dest);
5764
deflateEnd(&stream);
5865
return err == Z_STREAM_END ? Z_OK : err;
5966
}
60-
67+
int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,
68+
uLong sourceLen, int level) {
69+
int ret;
70+
z_size_t got = *destLen;
71+
ret = compress2_z(dest, &got, source, sourceLen, level);
72+
*destLen = (uLong)got;
73+
return ret;
74+
}
6175
/* ===========================================================================
6276
*/
77+
int ZEXPORT compress_z(Bytef *dest, z_size_t *destLen, const Bytef *source,
78+
z_size_t sourceLen) {
79+
return compress2_z(dest, destLen, source, sourceLen,
80+
Z_DEFAULT_COMPRESSION);
81+
}
6382
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source,
6483
uLong sourceLen) {
6584
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
@@ -69,7 +88,12 @@ int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source,
6988
If the default memLevel or windowBits for deflateInit() is changed, then
7089
this function needs to be updated.
7190
*/
91+
z_size_t ZEXPORT compressBound_z(z_size_t sourceLen) {
92+
z_size_t bound = sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
93+
(sourceLen >> 25) + 13;
94+
return bound < sourceLen ? (z_size_t)-1 : bound;
95+
}
7296
uLong ZEXPORT compressBound(uLong sourceLen) {
73-
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
74-
(sourceLen >> 25) + 13;
97+
z_size_t bound = compressBound_z(sourceLen);
98+
return (uLong)bound != bound ? (uLong)-1 : (uLong)bound;
7599
}

0 commit comments

Comments
 (0)