deps: update zlib to 1.3.1-470d3a2 · nodejs/node@dc10238 · GitHub
Skip to content

Commit dc10238

Browse files
nodejs-github-bottargos
authored andcommitted
deps: update zlib to 1.3.1-470d3a2
PR-URL: #58628 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 4347ce3 commit dc10238

44 files changed

Lines changed: 890 additions & 324 deletions

Some content is hidden

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

deps/zlib/BUILD.gn

Lines changed: 12 additions & 6 deletions

deps/zlib/CMakeLists.txt

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

44
project(zlib C)
55

6-
set(VERSION "1.3.0.1")
6+
set(VERSION "1.3.1")
77

88
set(INSTALL_BIN_DIR "${CMAKE_INSTALL_PREFIX}/bin" CACHE PATH "Installation directory for executables")
99
set(INSTALL_LIB_DIR "${CMAKE_INSTALL_PREFIX}/lib" CACHE PATH "Installation directory for libraries")
@@ -47,6 +47,7 @@ if (ENABLE_SIMD_OPTIMIZATIONS)
4747
add_definitions(-DINFLATE_CHUNK_SIMD_SSE2)
4848
add_definitions(-DADLER32_SIMD_SSSE3)
4949
add_definitions(-DINFLATE_CHUNK_READ_64LE)
50+
add_definitions(-DDEFLATE_CHUNK_WRITE_64LE)
5051
add_definitions(-DCRC32_SIMD_SSE42_PCLMUL)
5152
if (ENABLE_SIMD_AVX512)
5253
add_definitions(-DCRC32_SIMD_AVX512_PCLMUL)
@@ -64,6 +65,7 @@ if (ENABLE_SIMD_OPTIMIZATIONS)
6465
add_definitions(-DINFLATE_CHUNK_SIMD_NEON)
6566
add_definitions(-DADLER32_SIMD_NEON)
6667
add_definitions(-DINFLATE_CHUNK_READ_64LE)
68+
add_definitions(-DDEFLATE_CHUNK_WRITE_64LE)
6769
add_definitions(-DCRC32_ARMV8_CRC32)
6870
add_definitions(-DDEFLATE_SLIDE_HASH_NEON)
6971
# Required by CPU features detection code.
@@ -83,10 +85,13 @@ if (ENABLE_SIMD_OPTIMIZATIONS)
8385
add_definitions(-DDEFLATE_SLIDE_HASH_RVV)
8486
add_definitions(-DADLER32_SIMD_RVV)
8587

86-
# TODO(cavalcantii): add remaining flags as we port optimizations to RVV.
8788
# chunk_copy is required for READ64 and unconditional decode of literals.
8889
add_definitions(-DINFLATE_CHUNK_GENERIC)
8990
add_definitions(-DINFLATE_CHUNK_READ_64LE)
91+
add_definitions(-DDEFLATE_CHUNK_WRITE_64LE)
92+
93+
# TODO(cavalcantii): only missing optimization is SLIDE_HASH, got port it
94+
# to RISCV.
9095

9196
# Tested with clang-17, unaligned loads are required by read64 & chunk_copy.
9297
# TODO(cavalcantii): replace internal clang flags for -munaligned-access
@@ -267,7 +272,9 @@ if(MINGW)
267272
endif(MINGW)
268273

269274
add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
275+
target_include_directories(zlib PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
270276
add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS})
277+
target_include_directories(zlibstatic PUBLIC ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
271278
set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL)
272279
set_target_properties(zlib PROPERTIES SOVERSION 1)
273280

deps/zlib/OWNERS

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
agl@chromium.org
21
cavalcantii@chromium.org
3-
cblume@chromium.org
4-
scroggo@google.com
2+
hans@chromium.org
3+
agl@chromium.org #{LAST_RESORT_SUGGESTION}

deps/zlib/README.chromium

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
Name: zlib
22
Short Name: zlib
33
URL: http://zlib.net/
4-
Version: 1.3.0.1
5-
Revision: ac8f12c97d1afd9bafa9c710f827d40a407d3266
6-
CPEPrefix: cpe:/a:zlib:zlib:1.3.0.1
4+
Version: 1.3.1
5+
Revision: 51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf
6+
CPEPrefix: cpe:/a:zlib:zlib:1.3.1
77
Security Critical: yes
88
Shipped: yes
99
License: Zlib
@@ -21,14 +21,17 @@ also implements the zlib (RFC 1950) and gzip (RFC 1952) wrapper formats.
2121
Local Modifications:
2222
- Only source code from the zlib distribution used to build the zlib and
2323
minizip libraries are present. Many other files have been omitted. Only *.c
24-
and *.h files from the upstream root directory and contrib/minizip were
25-
imported.
24+
and *.h files from the upstream root directory, contrib/minizip and
25+
examples/zpipe.c were imported.
26+
- The files named '*simd*' are original x86/Arm/RISC-V specific optimizations.
2627
- The contents of the google directory are original Chromium-specific
2728
additions.
29+
- The contents of the 'contrib' of directory are either Chromium-specific
30+
additions or heavily patched zlib files (e.g. inffast_chunk*).
2831
- Added chromeconf.h
2932
- Plus the changes in 'patches' folder.
3033
- Code in contrib/ other than contrib/minizip was added to match zlib's
3134
contributor layout.
32-
- In sync with 1.2.13 official release
35+
- In sync with 1.3.1 official release
3336
- ZIP reader modified to allow for progress callbacks during extraction.
3437
- ZIP reader modified to add detection of AES encrypted content.

deps/zlib/contrib/minizip/README.chromium

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,8 @@ Local Modifications:
3434
https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT section 4.6.9.
3535
(see crrev.com/1002476)
3636
0016-minizip-parse-unicode-path-extra-field.patch
37+
38+
- Added support for zip64 archives that have extra bytes on front (for example,
39+
large CRX files).
40+
0018-support-prefixed-zip64.patch
41+

deps/zlib/contrib/minizip/unzip.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -482,6 +482,46 @@ local ZPOS64_T unz64local_SearchCentralDir64(const zlib_filefunc64_32_def* pzlib
482482
if (uL != 1)
483483
return CENTRALDIRINVALID;
484484

485+
/* If bytes are pre-pended to the archive, relativeOffset must be advanced
486+
by that many bytes. The central dir must exist between the specified
487+
relativeOffset and uPosFound. */
488+
if (relativeOffset > uPosFound)
489+
return CENTRALDIRINVALID;
490+
const int BUFSIZE = 1024 * 4;
491+
buf = (unsigned char*)ALLOC(BUFSIZE);
492+
if (buf==NULL)
493+
return CENTRALDIRINVALID;
494+
// Zip64 EOCDR is at least 48 bytes long.
495+
while (uPosFound - relativeOffset >= 48) {
496+
int found = 0;
497+
uLong uReadSize = uPosFound - relativeOffset;
498+
if (uReadSize > BUFSIZE) {
499+
uReadSize = BUFSIZE;
500+
}
501+
if (ZSEEK64(*pzlib_filefunc_def, filestream, relativeOffset, ZLIB_FILEFUNC_SEEK_SET) != 0) {
502+
break;
503+
}
504+
if (ZREAD64(*pzlib_filefunc_def, filestream, buf, uReadSize) != uReadSize) {
505+
break;
506+
}
507+
for (int i = 0; i < uReadSize - 3; ++i) {
508+
// Looking for 0x06064b50, the Zip64 EOCDR signature.
509+
if (buf[i] == 0x50 && buf[i + 1] == 0x4b &&
510+
buf[i + 2] == 0x06 && buf[i + 3] == 0x06)
511+
{
512+
relativeOffset += i;
513+
found = 1;
514+
break;
515+
}
516+
}
517+
if (found) {
518+
break;
519+
}
520+
// Re-read the last 3 bytes, in case they're the front of the signature.
521+
relativeOffset += uReadSize - 3;
522+
}
523+
free(buf);
524+
485525
/* Goto end of central directory record */
486526
if (ZSEEK64(*pzlib_filefunc_def,filestream, relativeOffset,ZLIB_FILEFUNC_SEEK_SET)!=0)
487527
return CENTRALDIRINVALID;
@@ -1005,6 +1045,8 @@ local int unz64local_GetCurrentFileInfoInternal(unzFile file,
10051045
{
10061046
uLong uSizeRead;
10071047

1048+
file_info.size_filename = fileNameSize;
1049+
10081050
if (fileNameSize < fileNameBufferSize)
10091051
{
10101052
*(szFileName + fileNameSize) = '\0';

deps/zlib/contrib/tests/fuzzers/BUILD.gn

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,9 @@ fuzzer_test("zlib_deflate_fuzzer") {
4343
sources = [ "deflate_fuzzer.cc" ]
4444
deps = [ "../../../:zlib" ]
4545
}
46+
47+
fuzzer_test("minizip_unzip_fuzzer") {
48+
sources = [ "minizip_unzip_fuzzer.cc" ]
49+
deps = [ "../../../:minizip" ]
50+
include_dirs = [ "//third_party/zlib/contrib/minizip" ]
51+
}
Lines changed: 119 additions & 0 deletions

0 commit comments

Comments
 (0)