Skip to content

CDRIVER-4624 upgrade zlib 1.2.12 to 1.2.13 #1252

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 1, 2023
Merged
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
2 changes: 1 addition & 1 deletion .evergreen/.codecov.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
ignore:
- "src/libmongoc/tests/mock_server"
- "src/zlib-1.2.12"
- "src/zlib-1.2.13"
2 changes: 1 addition & 1 deletion .evergreen/scripts/check-files.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
cmake_produced = [
"libbson/src/bson/bson-version.h",
"libmongoc/src/mongoc/mongoc-version.h",
"zlib-1.2.12/zconf.h",
"zlib-1.2.13/zconf.h",
]

for root, dirs, files in os.walk(REPO_SRC_DIR):
Expand Down
30 changes: 15 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -316,21 +316,21 @@ if (ENABLE_MONGOC)
set (SOURCE_DIR "${PROJECT_SOURCE_DIR}/")

set (ZLIB_SOURCES
${SOURCE_DIR}/src/zlib-1.2.12/adler32.c
${SOURCE_DIR}/src/zlib-1.2.12/crc32.c
${SOURCE_DIR}/src/zlib-1.2.12/deflate.c
${SOURCE_DIR}/src/zlib-1.2.12/infback.c
${SOURCE_DIR}/src/zlib-1.2.12/inffast.c
${SOURCE_DIR}/src/zlib-1.2.12/inflate.c
${SOURCE_DIR}/src/zlib-1.2.12/inftrees.c
${SOURCE_DIR}/src/zlib-1.2.12/trees.c
${SOURCE_DIR}/src/zlib-1.2.12/zutil.c
${SOURCE_DIR}/src/zlib-1.2.12/compress.c
${SOURCE_DIR}/src/zlib-1.2.12/uncompr.c
${SOURCE_DIR}/src/zlib-1.2.12/gzclose.c
${SOURCE_DIR}/src/zlib-1.2.12/gzlib.c
${SOURCE_DIR}/src/zlib-1.2.12/gzread.c
${SOURCE_DIR}/src/zlib-1.2.12/gzwrite.c
${SOURCE_DIR}/src/zlib-1.2.13/adler32.c
${SOURCE_DIR}/src/zlib-1.2.13/crc32.c
${SOURCE_DIR}/src/zlib-1.2.13/deflate.c
${SOURCE_DIR}/src/zlib-1.2.13/infback.c
${SOURCE_DIR}/src/zlib-1.2.13/inffast.c
${SOURCE_DIR}/src/zlib-1.2.13/inflate.c
${SOURCE_DIR}/src/zlib-1.2.13/inftrees.c
${SOURCE_DIR}/src/zlib-1.2.13/trees.c
${SOURCE_DIR}/src/zlib-1.2.13/zutil.c
${SOURCE_DIR}/src/zlib-1.2.13/compress.c
${SOURCE_DIR}/src/zlib-1.2.13/uncompr.c
${SOURCE_DIR}/src/zlib-1.2.13/gzclose.c
${SOURCE_DIR}/src/zlib-1.2.13/gzlib.c
${SOURCE_DIR}/src/zlib-1.2.13/gzread.c
${SOURCE_DIR}/src/zlib-1.2.13/gzwrite.c
)

set (MONGOC_ENABLE_ICU 0)
Expand Down
24 changes: 12 additions & 12 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@
add_subdirectory (tools)

# zconf.h is generated by configure_file() in the parent CMakeLists.txt
extra_dist_generated (zlib-1.2.12/zconf.h)
extra_dist_generated (zlib-1.2.13/zconf.h)
set (src_zlib_DIST
src/zlib-1.2.12/crc32.h
src/zlib-1.2.12/deflate.h
src/zlib-1.2.12/gzguts.h
src/zlib-1.2.12/inffast.h
src/zlib-1.2.12/inffixed.h
src/zlib-1.2.12/inflate.h
src/zlib-1.2.12/inftrees.h
src/zlib-1.2.12/trees.h
src/zlib-1.2.12/zconf.h.in
src/zlib-1.2.12/zlib.h
src/zlib-1.2.12/zutil.h
src/zlib-1.2.13/crc32.h
src/zlib-1.2.13/deflate.h
src/zlib-1.2.13/gzguts.h
src/zlib-1.2.13/inffast.h
src/zlib-1.2.13/inffixed.h
src/zlib-1.2.13/inflate.h
src/zlib-1.2.13/inftrees.h
src/zlib-1.2.13/trees.h
src/zlib-1.2.13/zconf.h.in
src/zlib-1.2.13/zlib.h
src/zlib-1.2.13/zutil.h
)
# Strip leading directory components to make the paths relative for MakeDist.
# The ZLIB_SOURCES list is set in the top-level CMakeLists.txt.
Expand Down
12 changes: 6 additions & 6 deletions src/libmongoc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ endif ()
# Copy zconf.h.in to zconf.h; even when using system zlib, the 'dist' target
# will look for zconf.h in that location.
configure_file (
"${SOURCE_DIR}/src/zlib-1.2.12/zconf.h.in"
"${CMAKE_BINARY_DIR}/src/zlib-1.2.12/zconf.h"
"${SOURCE_DIR}/src/zlib-1.2.13/zconf.h.in"
"${CMAKE_BINARY_DIR}/src/zlib-1.2.13/zconf.h"
COPYONLY
)
set (ZLIB_INCLUDE_DIRS "")
Expand Down Expand Up @@ -80,17 +80,17 @@ if ( (ENABLE_ZLIB STREQUAL "BUNDLED")
# This tells the bundled zlib where to find its generated headers
target_include_directories (zlib_obj
BEFORE PUBLIC
"${SOURCE_DIR}/src/zlib-1.2.12"
"${CMAKE_BINARY_DIR}/src/zlib-1.2.12"
"${SOURCE_DIR}/src/zlib-1.2.13"
"${CMAKE_BINARY_DIR}/src/zlib-1.2.13"
)
# Disable all warnings for compiling Zlib
target_compile_options (zlib_obj PRIVATE -w)
set (SOURCES ${SOURCES} $<TARGET_OBJECTS:zlib_obj>)
# This tells mongoc_shared/mongoc_static where to find generated zlib headers
set (
ZLIB_INCLUDE_DIRS
"${SOURCE_DIR}/src/zlib-1.2.12"
"${CMAKE_BINARY_DIR}/src/zlib-1.2.12"
"${SOURCE_DIR}/src/zlib-1.2.13"
"${CMAKE_BINARY_DIR}/src/zlib-1.2.13"
)
endif ()

Expand Down
Binary file removed src/zlib-1.2.12/zlib.3.pdf
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)

project(zlib C)

set(VERSION "1.2.12")

option(ASM686 "Enable building i686 assembly implementation")
option(AMD64 "Enable building amd64 assembly implementation")
set(VERSION "1.2.13")

set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
Expand Down Expand Up @@ -129,39 +126,6 @@ if(NOT MINGW)
)
endif()

if(CMAKE_COMPILER_IS_GNUCC)
if(ASM686)
set(ZLIB_ASMS contrib/asm686/match.S)
elseif (AMD64)
set(ZLIB_ASMS contrib/amd64/amd64-match.S)
endif ()

if(ZLIB_ASMS)
add_definitions(-DASMV)
set_source_files_properties(${ZLIB_ASMS} PROPERTIES LANGUAGE C COMPILE_FLAGS -DNO_UNDERLINE)
endif()
endif()

if(MSVC)
if(ASM686)
ENABLE_LANGUAGE(ASM_MASM)
set(ZLIB_ASMS
contrib/masmx86/inffas32.asm
contrib/masmx86/match686.asm
)
elseif (AMD64)
ENABLE_LANGUAGE(ASM_MASM)
set(ZLIB_ASMS
contrib/masmx64/gvmat64.asm
contrib/masmx64/inffasx64.asm
)
endif()

if(ZLIB_ASMS)
add_definitions(-DASMV -DASMINF)
endif()
endif()

# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents)
string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*"
Expand All @@ -183,8 +147,8 @@ if(MINGW)
set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj)
endif(MINGW)

add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
set_target_properties(zlib PROPERTIES SOVERSION 1)

Expand Down
24 changes: 18 additions & 6 deletions src/zlib-1.2.12/ChangeLog → src/zlib-1.2.13/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@

ChangeLog file for zlib

Changes in 1.2.13 (13 Oct 2022)
- Fix configure issue that discarded provided CC definition
- Correct incorrect inputs provided to the CRC functions
- Repair prototypes and exporting of new CRC functions
- Fix inflateBack to detect invalid input with distances too far
- Have infback() deliver all of the available output up to any error
- Fix a bug when getting a gzip header extra field with inflate()
- Fix bug in block type selection when Z_FIXED used
- Tighten deflateBound bounds
- Remove deleted assembler code references
- Various portability and appearance improvements

Changes in 1.2.12 (27 Mar 2022)
- Cygwin does not have _wopen(), so do not create gzopen_w() there
- Permit a deflateParams() parameter change as soon as possible
Expand Down Expand Up @@ -159,7 +171,7 @@ Changes in 1.2.7.1 (24 Mar 2013)
- Fix types in contrib/minizip to match result of get_crc_table()
- Simplify contrib/vstudio/vc10 with 'd' suffix
- Add TOP support to win32/Makefile.msc
- Suport i686 and amd64 assembler builds in CMakeLists.txt
- Support i686 and amd64 assembler builds in CMakeLists.txt
- Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h
- Add vc11 and vc12 build files to contrib/vstudio
- Add gzvprintf() as an undocumented function in zlib
Expand Down Expand Up @@ -359,14 +371,14 @@ Changes in 1.2.5.1 (10 Sep 2011)
- Use u4 type for crc_table to avoid conversion warnings
- Apply casts in zlib.h to avoid conversion warnings
- Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller]
- Improve inflateSync() documentation to note indeterminancy
- Improve inflateSync() documentation to note indeterminacy
- Add deflatePending() function to return the amount of pending output
- Correct the spelling of "specification" in FAQ [Randers-Pehrson]
- Add a check in configure for stdarg.h, use for gzprintf()
- Check that pointers fit in ints when gzprint() compiled old style
- Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler]
- Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt]
- Add debug records in assmebler code [Londer]
- Add debug records in assembler code [Londer]
- Update RFC references to use http://tools.ietf.org/html/... [Li]
- Add --archs option, use of libtool to configure for Mac OS X [Borstel]

Expand Down Expand Up @@ -1033,7 +1045,7 @@ Changes in 1.2.0.1 (17 March 2003)
- Include additional header file on VMS for off_t typedef
- Try to use _vsnprintf where it supplants vsprintf [Vollant]
- Add some casts in inffast.c
- Enchance comments in zlib.h on what happens if gzprintf() tries to
- Enhance comments in zlib.h on what happens if gzprintf() tries to
write more than 4095 bytes before compression
- Remove unused state from inflateBackEnd()
- Remove exit(0) from minigzip.c, example.c
Expand Down Expand Up @@ -1211,7 +1223,7 @@ Changes in 1.0.9 (17 Feb 1998)
- Avoid gcc 2.8.0 comparison bug a little differently than zlib 1.0.8
- in inftrees.c, avoid cc -O bug on HP (Farshid Elahi)
- in zconf.h move the ZLIB_DLL stuff earlier to avoid problems with
the declaration of FAR (Gilles VOllant)
the declaration of FAR (Gilles Vollant)
- install libz.so* with mode 755 (executable) instead of 644 (Marc Lehmann)
- read_buf buf parameter of type Bytef* instead of charf*
- zmemcpy parameters are of type Bytef*, not charf* (Joseph Strout)
Expand Down Expand Up @@ -1567,7 +1579,7 @@ Changes in 0.4:
- renamed deflateOptions as deflateInit2, call one or the other but not both
- added the method parameter for deflateInit2
- added inflateInit2
- simplied considerably deflateInit and inflateInit by not supporting
- simplified considerably deflateInit and inflateInit by not supporting
user-provided history buffer. This is supported only in deflateInit2
and inflateInit2

Expand Down
File renamed without changes.
File renamed without changes.
20 changes: 8 additions & 12 deletions src/zlib-1.2.12/Makefile.in → src/zlib-1.2.13/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
# Normally configure builds both a static and a shared library.
# If you want to build just a static library, use: ./configure --static

# To use the asm code, type:
# cp contrib/asm?86/match.S ./match.S
# make LOC=-DASMV OBJA=match.o

# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
# make install
# To install in $HOME instead of /usr/local, use:
Expand All @@ -26,13 +22,13 @@ CFLAGS=-O

SFLAGS=-O
LDFLAGS=
TEST_LDFLAGS=-L. libz.a
TEST_LDFLAGS=$(LDFLAGS) -L. libz.a
LDSHARED=$(CC)
CPP=$(CC) -E

STATICLIB=libz.a
SHAREDLIB=libz.so
SHAREDLIBV=libz.so.1.2.12
SHAREDLIBV=libz.so.1.2.13
SHAREDLIBM=libz.so.1
LIBS=$(STATICLIB) $(SHAREDLIBV)

Expand Down Expand Up @@ -87,7 +83,7 @@ test: all teststatic testshared

teststatic: static
@TMPST=tmpst_$$; \
if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \
if echo hello world | ${QEMU_RUN} ./minigzip | ${QEMU_RUN} ./minigzip -d && ${QEMU_RUN} ./example $$TMPST ; then \
echo ' *** zlib test OK ***'; \
else \
echo ' *** zlib test FAILED ***'; false; \
Expand All @@ -100,7 +96,7 @@ testshared: shared
DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
TMPSH=tmpsh_$$; \
if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH; then \
if echo hello world | ${QEMU_RUN} ./minigzipsh | ${QEMU_RUN} ./minigzipsh -d && ${QEMU_RUN} ./examplesh $$TMPSH; then \
echo ' *** zlib shared test OK ***'; \
else \
echo ' *** zlib shared test FAILED ***'; false; \
Expand All @@ -109,7 +105,7 @@ testshared: shared

test64: all64
@TMP64=tmp64_$$; \
if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \
if echo hello world | ${QEMU_RUN} ./minigzip64 | ${QEMU_RUN} ./minigzip64 -d && ${QEMU_RUN} ./example64 $$TMP64; then \
echo ' *** zlib 64-bit test OK ***'; \
else \
echo ' *** zlib 64-bit test FAILED ***'; false; \
Expand All @@ -124,7 +120,7 @@ infcover: infcover.o libz.a

cover: infcover
rm -f *.gcda
./infcover
${QEMU_RUN} ./infcover
gcov inf*.c

libz.a: $(OBJS)
Expand Down Expand Up @@ -292,10 +288,10 @@ minigzip$(EXE): minigzip.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS)

examplesh$(EXE): example.o $(SHAREDLIBV)
$(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
$(CC) $(CFLAGS) -o $@ example.o $(LDFLAGS) -L. $(SHAREDLIBV)

minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
$(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
$(CC) $(CFLAGS) -o $@ minigzip.o $(LDFLAGS) -L. $(SHAREDLIBV)

example64$(EXE): example64.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS)
Expand Down
4 changes: 2 additions & 2 deletions src/zlib-1.2.12/README → src/zlib-1.2.13/README
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ZLIB DATA COMPRESSION LIBRARY

zlib 1.2.12 is a general purpose data compression library. All the code is
zlib 1.2.13 is a general purpose data compression library. All the code is
thread safe. The data format used by the zlib library is described by RFCs
(Request for Comments) 1950 to 1952 in the files
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
Expand Down Expand Up @@ -31,7 +31,7 @@ Mark Nelson <[email protected]> wrote an article about zlib for the Jan. 1997
issue of Dr. Dobb's Journal; a copy of the article is available at
http://marknelson.us/1997/01/01/zlib-engine/ .

The changes made in version 1.2.12 are documented in the file ChangeLog.
The changes made in version 1.2.13 are documented in the file ChangeLog.

Unsupported third party contributions are provided in directory contrib/ .

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions src/zlib-1.2.12/compress.c → src/zlib-1.2.13/compress.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
Z_STREAM_ERROR if the level parameter is invalid.
*/
int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
int ZEXPORT compress2(dest, destLen, source, sourceLen, level)
Bytef *dest;
uLongf *destLen;
const Bytef *source;
Expand Down Expand Up @@ -65,7 +65,7 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)

/* ===========================================================================
*/
int ZEXPORT compress (dest, destLen, source, sourceLen)
int ZEXPORT compress(dest, destLen, source, sourceLen)
Bytef *dest;
uLongf *destLen;
const Bytef *source;
Expand All @@ -78,7 +78,7 @@ int ZEXPORT compress (dest, destLen, source, sourceLen)
If the default memLevel or windowBits for deflateInit() is changed, then
this function needs to be updated.
*/
uLong ZEXPORT compressBound (sourceLen)
uLong ZEXPORT compressBound(sourceLen)
uLong sourceLen;
{
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
Expand Down
Loading