Skip to content

Commit 97346cc

Browse files
bmehta001Copilot
andauthored
Update vendored zlib to 1.4 (#1558)
* Update vendored zlib to 1.4 for security fixes Refresh the vendored dependency to upstream v1.4 to pick up its security and correctness fixes. Preserve the SDK symbol prefix and legacy build targets, align the CMake configuration with native Windows large-file support, and exercise 64-bit offset consumers on Windows. Files changed: cgmanifest.json zlib/CMakeLists.txt zlib/ChangeLog zlib/Makefile.in zlib/compress.c zlib/configure zlib/contrib/delphi/ZLib.pas zlib/contrib/dotzlib/DotZLib/UnitTests.cs zlib/contrib/infback9/inftree9.c zlib/contrib/minizip/CMakeLists.txt zlib/contrib/minizip/Makefile.am zlib/contrib/minizip/configure.ac zlib/contrib/minizip/crypt.h zlib/contrib/minizip/ioapi.h zlib/contrib/minizip/miniunz.c zlib/contrib/minizip/minizipConfig.cmake.in zlib/contrib/minizip/mztools.c zlib/contrib/minizip/skipset.h zlib/contrib/minizip/test/CMakeLists.txt zlib/contrib/minizip/test/add_subdirectory_exclude_test.cmake.in zlib/contrib/minizip/test/add_subdirectory_test.cmake.in zlib/contrib/minizip/test/find_package_no_components_test.cmake.in zlib/contrib/minizip/test/find_package_test.cmake.in zlib/contrib/minizip/test/find_package_wrong_components_test.cmake.in zlib/contrib/minizip/unzip.c zlib/contrib/minizip/unzip.h zlib/contrib/minizip/zip.c zlib/contrib/minizip/zip.h zlib/contrib/pascal/zlibpas.pas zlib/crc32.c zlib/deflate.c zlib/gzguts.h zlib/gzlib.c zlib/gzread.c zlib/gzwrite.c zlib/infback.c zlib/inflate.c zlib/inflate.h zlib/inftrees.c zlib/inftrees.h zlib/qnx/package.qpg zlib/test/infcover.c zlib/test/minigzip.c zlib/treebuild.xml zlib/trees.c zlib/uncompr.c zlib/win32/Makefile.msc zlib/win32/README-WIN32.txt zlib/zconf.h zlib/zconf.h.cmakein zlib/zconf.h.in zlib/zlib.3 zlib/zlib.3.pdf zlib/zlib.h zlib/zlib.pc.cmakein zlib/zutil.c Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 75db4712-f7f2-445b-bb95-9881e4c13228 * Replace retired macOS 14 CI runners to restore iOS validation Use supported macos-26 runners and their installed iPhone 17 and iPad Pro 11-inch (M5) simulators. Preserve the macos-15 jobs, all eight debug/release phone/tablet combinations, and the existing iOS deployment targets. Files changed: .github/workflows/build-ios-mac.yml Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 75db4712-f7f2-445b-bb95-9881e4c13228 --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 75db4712-f7f2-445b-bb95-9881e4c13228
1 parent 114a2c5 commit 97346cc

64 files changed

Lines changed: 1878 additions & 954 deletions

Some content is hidden

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

‎.github/workflows/build-ios-mac.yml‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,18 +63,18 @@ jobs:
6363
build:
6464
strategy:
6565
matrix:
66-
os: [macos-14, macos-15]
66+
os: [macos-26, macos-15]
6767
config: [release, debug]
68-
simulator: ["'iPhone 15'", "'iPad Pro (11-inch) (4th generation)'", "'iPhone 16'", "'iPad Air 11-inch (M2)'"]
68+
simulator: ["'iPhone 17'", "'iPad Pro 11-inch (M5)'", "'iPhone 16'", "'iPad Air 11-inch (M2)'"]
6969
exclude:
70-
- os: macos-14
70+
- os: macos-26
7171
simulator: "'iPhone 16'"
72-
- os: macos-14
72+
- os: macos-26
7373
simulator: "'iPad Air 11-inch (M2)'"
7474
- os: macos-15
75-
simulator: "'iPhone 15'"
75+
simulator: "'iPhone 17'"
7676
- os: macos-15
77-
simulator: "'iPad Pro (11-inch) (4th generation)'"
77+
simulator: "'iPad Pro 11-inch (M5)'"
7878
runs-on: ${{ matrix.os }}
7979
timeout-minutes: 60
8080
env:
@@ -88,7 +88,7 @@ jobs:
8888
run: git submodule update --init --depth=1 third_party/googletest
8989
- name: build
9090
run: |
91-
if [[ "${{ matrix.os }}" == "macos-14" ]]; then
91+
if [[ "${{ matrix.os }}" == "macos-26" ]]; then
9292
export CMAKE_OSX_DEPLOYMENT_TARGET=13.0;
9393
elif [[ "${{ matrix.os }}" == "macos-15" ]]; then
9494
export CMAKE_OSX_DEPLOYMENT_TARGET=15.0;

‎Package.swift‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,8 @@ let package = Package(
104104
name: "MATTelemetry",
105105
path: "build/apple/MATTelemetry.xcframework") : .binaryTarget(
106106
name: "MATTelemetry",
107-
url: "https://github.com/microsoft/cpp_client_telemetry/releases/download/v3.10.281.1/MATTelemetry.xcframework.zip",
108-
checksum: "799b956dde6c6dccdc46b762b14eca55f677608f81b12879031fbd9c91470812"),
107+
url: "https://github.com/microsoft/cpp_client_telemetry/releases/download/v3.10.309.1/MATTelemetry.xcframework.zip",
108+
checksum: "12b20684bcf09f8daec9c5ee1a1ecd567c354d4dea3273ba7023a40b7d0c4589"),
109109

110110
// Thin Swift API layer (source). Depends on the Obj-C module from the
111111
// xcframework. The conditional source exclusions above must stay in sync

‎cgmanifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"Type": "git",
2727
"git": {
2828
"RepositoryUrl": "https://github.com/madler/zlib",
29-
"CommitHash": "da607da739fa6047df13e66a2af6b8bec7c2a498"
29+
"CommitHash": "99623ef7097352da7993ba614161fd6a311e046e"
3030
}
3131
},
3232
"DevelopmentDependency": false

‎lib/android_build/build.gradle‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ ext {
44
buildscript {
55
repositories {
66
google() // to fetch com.android.tools.build:gradle
7+
// Avoid Maven Central rate limits on shared CI runner addresses.
8+
maven { url 'https://maven-central.storage-download.googleapis.com/maven2/' }
79
mavenCentral()
810
}
911
dependencies {
@@ -16,6 +18,7 @@ buildscript {
1618
allprojects {
1719
repositories {
1820
google() // to fetch com.android.tools.build:gradle
21+
maven { url 'https://maven-central.storage-download.googleapis.com/maven2/' }
1922
mavenCentral()
2023
}
2124
}

‎lib/include/public/Version.hpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
#define MAT_VERSION_HPP
77
// WARNING: DO NOT MODIFY THIS FILE!
88
// This file has been automatically generated, manual changes will be lost.
9-
#define BUILD_VERSION_STR "3.10.309.1"
10-
#define BUILD_VERSION 3,10,309,1
9+
#define BUILD_VERSION_STR "3.10.310.1"
10+
#define BUILD_VERSION 3,10,310,1
1111

1212
#ifndef RESOURCE_COMPILER_INVOKED
1313
#include "ctmacros.hpp"
@@ -18,7 +18,7 @@ namespace MAT_NS_BEGIN {
1818
uint64_t const Version =
1919
((uint64_t)3 << 48) |
2020
((uint64_t)10 << 32) |
21-
((uint64_t)309 << 16) |
21+
((uint64_t)310 << 16) |
2222
((uint64_t)1);
2323

2424
} MAT_NS_END

‎zlib/CMakeLists.txt‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
33

44
project(zlib C)
55

6-
set(VERSION "1.3.2")
6+
set(VERSION "1.4")
7+
set(zlib_VERSION "${VERSION}")
78

89
option(ASM686 "Enable building i686 assembly implementation")
910
option(AMD64 "Enable building amd64 assembly implementation")
@@ -14,6 +15,9 @@ set(INSTALL_INC_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "Installation d
1415
set(INSTALL_MAN_DIR "${CMAKE_INSTALL_PREFIX}/share/man" CACHE PATH "Installation directory for manual pages")
1516
set(INSTALL_PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/share/pkgconfig" CACHE PATH "Installation directory for pkgconfig (.pc) files")
1617

18+
set(pc_libdir "${INSTALL_LIB_DIR}")
19+
set(pc_includedir "${INSTALL_INC_DIR}")
20+
1721
include(CheckTypeSize)
1822
include(CheckFunctionExists)
1923
include(CheckIncludeFile)
@@ -221,16 +225,16 @@ endif()
221225

222226
add_executable(example test/example.c)
223227
target_link_libraries(example zlib)
224-
add_test(example example)
228+
add_test(NAME example COMMAND example example.gz)
225229

226230
add_executable(minigzip test/minigzip.c)
227231
target_link_libraries(minigzip zlib)
228232

229-
if(HAVE_OFF64_T)
233+
if(HAVE_OFF64_T OR WIN32)
230234
add_executable(example64 test/example.c)
231235
target_link_libraries(example64 zlib)
232236
set_target_properties(example64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64")
233-
add_test(example64 example64)
237+
add_test(NAME example64 COMMAND example64 example64.gz)
234238

235239
add_executable(minigzip64 test/minigzip.c)
236240
target_link_libraries(minigzip64 zlib)

‎zlib/ChangeLog‎

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

22
ChangeLog file for zlib
33

4+
Changes in 1.4 (4 Nov 2026)
5+
- Change CMake library names on MSVC
6+
- Return z_off_t default to long for portability
7+
- Fail gzopen() with "x" if O_EXCL not available
8+
- Deliver all gzip data before reporting error
9+
- Fix gzwrite() buffer overflow (CVE-2026-85091)
10+
- Fix inflateGetDictionary() write past buffer on invalid window size
11+
- Fix window write overrun after inflateSync()
12+
- Fix read before provided data after repeated inflatePrime()'s
13+
- Fix write past pending buffer after repeated deflatePrime()'s
14+
- Fix copy of uninitialized memory by inflateBack() on invalid data
15+
- Fix copy of uninitialized memory after gzseek() as first write action
16+
- Fix read outside window after a deflateResetKeep() mid-stream
17+
- Avoid out-of-bounds pointer arithmetic in infback9() (CVE-2026-4738)
18+
- Fix several vulnerabilities in contrib/minizip
19+
- Fix truncated stream detection in gzread()
20+
- Fix pending skip handling in gzread()
21+
- Fix loss of zero fill on repeated gzseek()'s when writing
22+
- Fix inaccurate total_in after Z_NEED_DICT returned
23+
- Detect and report bad deflateSetDictionary() calls
24+
- Avoid undefined behaviors in C language usage
25+
- Fix minizip extra field overflows when almost full and need Zip64
26+
- Don't assume NULL is defined in compress.c and uncompr.c
27+
- Use the generated zconf.h when building test programs out of tree
28+
- Improve portability and functionality of CMake builds
29+
- Provide 64-bit file offsets on Windows with #defines as on Linux
30+
- Improve portability to Android, AIX, PowerPC, s390x, and Windows
31+
- Use a PCG random number generator instead of rand() in minizip
32+
- Clarify documentation
33+
- (See https://github.com/madler/zlib for all 195 commits)
34+
435
Changes in 1.3.2 (17 Feb 2026)
536
- Continued rewrite of CMake build [Vollstrecker]
637
- Various portability improvements

‎zlib/Makefile.in‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ VGFMAFLAG=
3131

3232
STATICLIB=libz.a
3333
SHAREDLIB=libz.so
34-
SHAREDLIBV=libz.so.1.3.2
34+
SHAREDLIBV=libz.so.1.4
3535
SHAREDLIBM=libz.so.1
3636
LIBS=$(STATICLIB) $(SHAREDLIBV)
3737

@@ -40,6 +40,8 @@ ARFLAGS=rc
4040
RANLIB=ranlib
4141
LDCONFIG=ldconfig
4242
LDSHAREDLIBC=-lc
43+
SHAREDEXP=
44+
SHAREDEXPFLAG=
4345
TAR=tar
4446
SHELL=/bin/sh
4547
EXE=
@@ -285,13 +287,21 @@ gzwrite.lo: $(SRCDIR)gzwrite.c
285287
-@mv objs/gzwrite.o $@
286288

287289

288-
placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a $(SRCDIR)zlib.map
289-
$(LDSHARED) $(SFLAGS) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
290+
placebo $(SHAREDLIBV): $(PIC_OBJS) libz.a $(SRCDIR)zlib.map $(SHAREDEXP)
291+
$(LDSHARED) $(SFLAGS) $(SHAREDEXPFLAG) -o $@ $(PIC_OBJS) $(LDSHAREDLIBC) $(LDFLAGS)
290292
rm -f $(SHAREDLIB) $(SHAREDLIBM)
291293
ln -s $@ $(SHAREDLIB)
292294
ln -s $@ $(SHAREDLIBM)
293295
-@rmdir objs
294296

297+
libz.exp: $(PIC_OBJS)
298+
dump -tov -X 32_64 $(PIC_OBJS) | \
299+
awk '$$1 ~ /^\[[0-9]+\]$$/ && $$2 == "m" && \
300+
$$4 ~ /^\.(text|data|bss)$$/ && ($$6 == "extern" || $$6 == "weak") && \
301+
$$7 != "HIDDEN" && $$7 != "INTERNAL" && $$NF !~ /^\./ { print $$NF }' | \
302+
sort -u > $@
303+
@test -s $@ || { echo "no symbols found for $@" >&2; rm -f $@; false; }
304+
295305
example$(EXE): example.o $(STATICLIB)
296306
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(TEST_LIBS)
297307

‎zlib/compress.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ int ZEXPORT compress2_z(Bytef *dest, z_size_t *destLen, const Bytef *source,
2828
const uInt max = (uInt)-1;
2929
z_size_t left;
3030

31-
if ((sourceLen > 0 && source == NULL) ||
32-
destLen == NULL || (*destLen > 0 && dest == NULL))
31+
if ((sourceLen > 0 && source == Z_NULL) ||
32+
destLen == Z_NULL || (*destLen > 0 && dest == Z_NULL))
3333
return Z_STREAM_ERROR;
3434

3535
left = *destLen;

‎zlib/configure‎

Lines changed: 40 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ if test $SRCDIR = "."; then
2626
SRCDIR=""
2727
else
2828
ZINC='-I. -include zconf.h'
29-
ZINCOUT='-I. -I$(SRCDIR)'
29+
ZINCOUT='-I. -I$(SRCDIR) -include zconf.h'
3030
SRCDIR="$SRCDIR/"
3131
fi
3232

@@ -321,7 +321,9 @@ if test "$gcc" -eq 1 && ($cc -c $test.c) >> configure.log 2>&1; then
321321
esac ;;
322322
AIX*)
323323
LDSHARED=${LDSHARED-"$cc -shared"}
324-
LDFLAGS="${LDFLAGS} -Wl,-brtl" ;;
324+
LDFLAGS="${LDFLAGS} -Wl,-brtl"
325+
SHAREDEXP=libz.exp
326+
SHAREDEXPFLAG=-Wl,-bE:libz.exp ;;
325327
Darwin* | darwin* | *-darwin*)
326328
shared_ext='.dylib'
327329
SHAREDLIB=libz$shared_ext
@@ -403,6 +405,7 @@ else
403405
fi
404406
if test -n "$ZINC"; then
405407
ZINC='-I- -I. -I$(SRCDIR)'
408+
ZINCOUT='-I- -I. -I$(SRCDIR)'
406409
fi
407410
;;
408411
SunOS\ 4*) SFLAGS=${CFLAGS-"-O2 -PIC"}
@@ -507,6 +510,29 @@ else
507510
leave 1
508511
fi
509512

513+
# turn off useless GCC 5 warning about PowerPC vector type alignments.
514+
if test "$gcc" -eq 1; then
515+
cat > $test.c << EOF
516+
typedef int zvec __attribute__((vector_size(8)));
517+
struct zstruct { char c; zvec v; };
518+
int zfunc(struct zstruct *s) { return s->c; }
519+
EOF
520+
echo "Checking for gcc vector ABI notes..." >> configure.log
521+
show $CC -c $CFLAGS $test.c
522+
got=`( $CC -c $CFLAGS $test.c ) 2>&1`
523+
if test "$got" != ""; then
524+
printf "%s\n" "$got" >> configure.log
525+
fi
526+
case "$got" in
527+
*"changed in GCC 5"*)
528+
if tryboth $CC -c $CFLAGS -Wno-psabi $test.c; then
529+
echo "... turning the notes off with -Wno-psabi" >> configure.log
530+
CFLAGS="${CFLAGS} -Wno-psabi"
531+
SFLAGS="${SFLAGS} -Wno-psabi"
532+
fi ;;
533+
esac
534+
fi
535+
510536
echo >> configure.log
511537

512538
# see if shared library build supported
@@ -517,8 +543,15 @@ EOF
517543
if test $shared -eq 1; then
518544
echo Checking for shared library support... | tee -a configure.log
519545
# we must test in two steps (cc then ld), required at least on SunOS 4.x
546+
# the second link test is for linkers like lld that by default reject a
547+
# version script naming symbols that the test object doesn't define -- if
548+
# that's needed, keep the option, since some builds (e.g. --solo) don't
549+
# define all of the symbols in zlib.map
520550
if try $CC -c $SFLAGS $test.c &&
521-
try $LDSHARED $SFLAGS $LDFLAGS -o $test$shared_ext $test.o; then
551+
{ try $LDSHARED $SFLAGS $LDFLAGS -o $test$shared_ext $test.o ||
552+
{ try $LDSHARED $SFLAGS $LDFLAGS -Wl,--undefined-version \
553+
-o $test$shared_ext $test.o &&
554+
LDSHARED="$LDSHARED -Wl,--undefined-version"; }; }; then
522555
echo Building shared library $SHAREDLIBV with $CC. | tee -a configure.log
523556
elif test -z "$old_cc" -a -z "$old_cflags"; then
524557
echo No shared library support. | tee -a configure.log
@@ -1024,6 +1057,7 @@ sed < ${SRCDIR}Makefile.in "
10241057
/^LDFLAGS *=/s#=.*#=$LDFLAGS#
10251058
/^LDSHARED *=/s#=.*#=$LDSHARED#
10261059
/^CPP *=/s#=.*#=$CPP#
1060+
/^VGFMAFLAG *=/s#=.*#=$VGFMAFLAG#
10271061
/^STATICLIB *=/s#=.*#=$STATICLIB#
10281062
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#
10291063
/^SHAREDLIBV *=/s#=.*#=$SHAREDLIBV#
@@ -1033,6 +1067,8 @@ sed < ${SRCDIR}Makefile.in "
10331067
/^RANLIB *=/s#=.*#=$RANLIB#
10341068
/^LDCONFIG *=/s#=.*#=$LDCONFIG#
10351069
/^LDSHAREDLIBC *=/s#=.*#=$LDSHAREDLIBC#
1070+
/^SHAREDEXP *=/s#=.*#=$SHAREDEXP#
1071+
/^SHAREDEXPFLAG *=/s#=.*#=$SHAREDEXPFLAG#
10361072
/^EXE *=/s#=.*#=$EXE#
10371073
/^SRCDIR *=/s#=.*#=$SRCDIR#
10381074
/^ZINC *=/s#=.*#=$ZINC#
@@ -1054,6 +1090,7 @@ sed < ${SRCDIR}zlib.pc.in "
10541090
/^CC *=/s#=.*#=$CC#
10551091
/^CFLAGS *=/s#=.*#=$CFLAGS#
10561092
/^CPP *=/s#=.*#=$CPP#
1093+
/^VGFMAFLAG *=/s#=.*#=$VGFMAFLAG#
10571094
/^LDSHARED *=/s#=.*#=$LDSHARED#
10581095
/^STATICLIB *=/s#=.*#=$STATICLIB#
10591096
/^SHAREDLIB *=/s#=.*#=$SHAREDLIB#

0 commit comments

Comments
 (0)