Skip to content

Commit d5ff3c8

Browse files
[CDRIVER-5610] Bump bundled Zlib from 1.2.13 to 1.3.1 (#1651)
1 parent ea5dd12 commit d5ff3c8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1813
-1884
lines changed

CMakeLists.txt

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -454,21 +454,21 @@ if (ENABLE_MONGOC)
454454
)
455455

456456
set (ZLIB_SOURCES
457-
${SOURCE_DIR}/src/zlib-1.2.13/adler32.c
458-
${SOURCE_DIR}/src/zlib-1.2.13/crc32.c
459-
${SOURCE_DIR}/src/zlib-1.2.13/deflate.c
460-
${SOURCE_DIR}/src/zlib-1.2.13/infback.c
461-
${SOURCE_DIR}/src/zlib-1.2.13/inffast.c
462-
${SOURCE_DIR}/src/zlib-1.2.13/inflate.c
463-
${SOURCE_DIR}/src/zlib-1.2.13/inftrees.c
464-
${SOURCE_DIR}/src/zlib-1.2.13/trees.c
465-
${SOURCE_DIR}/src/zlib-1.2.13/zutil.c
466-
${SOURCE_DIR}/src/zlib-1.2.13/compress.c
467-
${SOURCE_DIR}/src/zlib-1.2.13/uncompr.c
468-
${SOURCE_DIR}/src/zlib-1.2.13/gzclose.c
469-
${SOURCE_DIR}/src/zlib-1.2.13/gzlib.c
470-
${SOURCE_DIR}/src/zlib-1.2.13/gzread.c
471-
${SOURCE_DIR}/src/zlib-1.2.13/gzwrite.c
457+
${SOURCE_DIR}/src/zlib-1.3.1/adler32.c
458+
${SOURCE_DIR}/src/zlib-1.3.1/crc32.c
459+
${SOURCE_DIR}/src/zlib-1.3.1/deflate.c
460+
${SOURCE_DIR}/src/zlib-1.3.1/infback.c
461+
${SOURCE_DIR}/src/zlib-1.3.1/inffast.c
462+
${SOURCE_DIR}/src/zlib-1.3.1/inflate.c
463+
${SOURCE_DIR}/src/zlib-1.3.1/inftrees.c
464+
${SOURCE_DIR}/src/zlib-1.3.1/trees.c
465+
${SOURCE_DIR}/src/zlib-1.3.1/zutil.c
466+
${SOURCE_DIR}/src/zlib-1.3.1/compress.c
467+
${SOURCE_DIR}/src/zlib-1.3.1/uncompr.c
468+
${SOURCE_DIR}/src/zlib-1.3.1/gzclose.c
469+
${SOURCE_DIR}/src/zlib-1.3.1/gzlib.c
470+
${SOURCE_DIR}/src/zlib-1.3.1/gzread.c
471+
${SOURCE_DIR}/src/zlib-1.3.1/gzwrite.c
472472
)
473473

474474
set (CPACK_RESOURCE_FILE_LICENSE "${SOURCE_DIR}/COPYING")

src/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
# Copy zconf.h.in to zconf.h, used by zlib
66
configure_file (
7-
"${SOURCE_DIR}/src/zlib-1.2.13/zconf.h.in"
8-
"${CMAKE_BINARY_DIR}/src/zlib-1.2.13/zconf.h"
7+
"${SOURCE_DIR}/src/zlib-1.3.1/zconf.h.in"
8+
"${CMAKE_BINARY_DIR}/src/zlib-1.3.1/zconf.h"
99
COPYONLY
1010
)
1111

src/libmongoc/CMakeLists.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,17 +75,17 @@ if ( (ENABLE_ZLIB STREQUAL "BUNDLED")
7575
# This tells the bundled zlib where to find its generated headers
7676
target_include_directories (zlib_obj
7777
BEFORE PUBLIC
78-
"${SOURCE_DIR}/src/zlib-1.2.13"
79-
"${CMAKE_BINARY_DIR}/src/zlib-1.2.13"
78+
"${SOURCE_DIR}/src/zlib-1.3.1"
79+
"${CMAKE_BINARY_DIR}/src/zlib-1.3.1"
8080
)
8181
# Disable all warnings for compiling Zlib
8282
target_compile_options (zlib_obj PRIVATE -w)
8383
set (SOURCES ${SOURCES} $<TARGET_OBJECTS:zlib_obj>)
8484
# This tells mongoc_shared/mongoc_static where to find generated zlib headers
8585
set (
8686
ZLIB_INCLUDE_DIRS
87-
"${SOURCE_DIR}/src/zlib-1.2.13"
88-
"${CMAKE_BINARY_DIR}/src/zlib-1.2.13"
87+
"${SOURCE_DIR}/src/zlib-1.3.1"
88+
"${CMAKE_BINARY_DIR}/src/zlib-1.3.1"
8989
)
9090
endif ()
9191

src/zlib-1.2.13/zlib.3.pdf

-18.9 KB
Binary file not shown.

src/zlib-1.2.13/zlib2ansi

Lines changed: 0 additions & 152 deletions
This file was deleted.

src/zlib-1.2.13/CMakeLists.txt renamed to src/zlib-1.3.1/CMakeLists.txt

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
cmake_minimum_required(VERSION 2.4.4)
1+
cmake_minimum_required(VERSION 2.4.4...3.15.0)
22
set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
33

44
project(zlib C)
55

6-
set(VERSION "1.2.13")
6+
set(VERSION "1.3.1")
7+
8+
option(ZLIB_BUILD_EXAMPLES "Enable Zlib Examples" ON)
79

810
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
911
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
@@ -148,7 +150,9 @@ if(MINGW)
148150
endif(MINGW)
149151

150152
add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
153+
target_include_directories(zlib PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
151154
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
155+
target_include_directories(zlibstatic PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
152156
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
153157
set_target_properties(zlib PROPERTIES SOVERSION 1)
154158

@@ -166,7 +170,7 @@ endif()
166170
if(UNIX)
167171
# On unix-like platforms the library is almost always called libz
168172
set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z)
169-
if(NOT APPLE)
173+
if(NOT APPLE AND NOT(CMAKE_SYSTEM_NAME STREQUAL AIX))
170174
set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"")
171175
endif()
172176
elseif(BUILD_SHARED_LIBS AND WIN32)
@@ -193,21 +197,22 @@ endif()
193197
#============================================================================
194198
# Example binaries
195199
#============================================================================
196-
197-
add_executable(example test/example.c)
198-
target_link_libraries(example zlib)
199-
add_test(example example)
200-
201-
add_executable(minigzip test/minigzip.c)
202-
target_link_libraries(minigzip zlib)
203-
204-
if(HAVE_OFF64_T)
205-
add_executable(example64 test/example.c)
206-
target_link_libraries(example64 zlib)
207-
set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
208-
add_test(example64 example64)
209-
210-
add_executable(minigzip64 test/minigzip.c)
211-
target_link_libraries(minigzip64 zlib)
212-
set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
200+
if(ZLIB_BUILD_EXAMPLES)
201+
add_executable(example test/example.c)
202+
target_link_libraries(example zlib)
203+
add_test(example example)
204+
205+
add_executable(minigzip test/minigzip.c)
206+
target_link_libraries(minigzip zlib)
207+
208+
if(HAVE_OFF64_T)
209+
add_executable(example64 test/example.c)
210+
target_link_libraries(example64 zlib)
211+
set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
212+
add_test(example64 example64)
213+
214+
add_executable(minigzip64 test/minigzip.c)
215+
target_link_libraries(minigzip64 zlib)
216+
set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
217+
endif()
213218
endif()

src/zlib-1.2.13/ChangeLog renamed to src/zlib-1.3.1/ChangeLog

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,34 @@
11

22
ChangeLog file for zlib
33

4+
Changes in 1.3.1 (22 Jan 2024)
5+
- Reject overflows of zip header fields in minizip
6+
- Fix bug in inflateSync() for data held in bit buffer
7+
- Add LIT_MEM define to use more memory for a small deflate speedup
8+
- Fix decision on the emission of Zip64 end records in minizip
9+
- Add bounds checking to ERR_MSG() macro, used by zError()
10+
- Neutralize zip file traversal attacks in miniunz
11+
- Fix a bug in ZLIB_DEBUG compiles in check_match()
12+
- Various portability and appearance improvements
13+
14+
Changes in 1.3 (18 Aug 2023)
15+
- Remove K&R function definitions and zlib2ansi
16+
- Fix bug in deflateBound() for level 0 and memLevel 9
17+
- Fix bug when gzungetc() is used immediately after gzopen()
18+
- Fix bug when using gzflush() with a very small buffer
19+
- Fix crash when gzsetparams() attempted for transparent write
20+
- Fix test/example.c to work with FORCE_STORED
21+
- Rewrite of zran in examples (see zran.c version history)
22+
- Fix minizip to allow it to open an empty zip file
23+
- Fix reading disk number start on zip64 files in minizip
24+
- Fix logic error in minizip argument processing
25+
- Add minizip testing to Makefile
26+
- Read multiple bytes instead of byte-by-byte in minizip unzip.c
27+
- Add memory sanitizer to configure (--memory)
28+
- Various portability improvements
29+
- Various documentation improvements
30+
- Various spelling and typo corrections
31+
432
Changes in 1.2.13 (13 Oct 2022)
533
- Fix configure issue that discarded provided CC definition
634
- Correct incorrect inputs provided to the CRC functions
@@ -1445,7 +1473,7 @@ Changes in 0.99 (27 Jan 96)
14451473
- fix typo in Make_vms.com (f$trnlnm -> f$getsyi)
14461474
- in fcalloc, normalize pointer if size > 65520 bytes
14471475
- don't use special fcalloc for 32 bit Borland C++
1448-
- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc...
1476+
- use STDC instead of __GO32__ to avoid redeclaring exit, calloc, etc.
14491477
- use Z_BINARY instead of BINARY
14501478
- document that gzclose after gzdopen will close the file
14511479
- allow "a" as mode in gzopen

src/zlib-1.2.13/FAQ renamed to src/zlib-1.3.1/FAQ

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
If your question is not there, please check the zlib home page
66
http://zlib.net/ which may have more recent information.
7-
The lastest zlib FAQ is at http://zlib.net/zlib_faq.html
7+
The latest zlib FAQ is at http://zlib.net/zlib_faq.html
88

99

1010
1. Is zlib Y2K-compliant?
@@ -14,8 +14,7 @@ The lastest zlib FAQ is at http://zlib.net/zlib_faq.html
1414
2. Where can I get a Windows DLL version?
1515

1616
The zlib sources can be compiled without change to produce a DLL. See the
17-
file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the
18-
precompiled DLL are found in the zlib web site at http://zlib.net/ .
17+
file win32/DLL_FAQ.txt in the zlib distribution.
1918

2019
3. Where can I get a Visual Basic interface to zlib?
2120

File renamed without changes.

src/zlib-1.3.1/LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Copyright notice:
2+
3+
(C) 1995-2022 Jean-loup Gailly and Mark Adler
4+
5+
This software is provided 'as-is', without any express or implied
6+
warranty. In no event will the authors be held liable for any damages
7+
arising from the use of this software.
8+
9+
Permission is granted to anyone to use this software for any purpose,
10+
including commercial applications, and to alter it and redistribute it
11+
freely, subject to the following restrictions:
12+
13+
1. The origin of this software must not be misrepresented; you must not
14+
claim that you wrote the original software. If you use this software
15+
in a product, an acknowledgment in the product documentation would be
16+
appreciated but is not required.
17+
2. Altered source versions must be plainly marked as such, and must not be
18+
misrepresented as being the original software.
19+
3. This notice may not be removed or altered from any source distribution.
20+
21+
Jean-loup Gailly Mark Adler
22+

src/zlib-1.3.1/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
all:
2+
-@echo "Please use ./configure first. Thank you."
3+
4+
distclean:
5+
make -f Makefile.in distclean

0 commit comments

Comments
 (0)