Skip to content

Commit

Permalink
deps: update zlib to 1.3.0.1-motley-dd5fc13
Browse files Browse the repository at this point in the history
PR-URL: #51105
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
  • Loading branch information
nodejs-github-bot authored and richardlau committed Mar 25, 2024
1 parent c61597f commit 09519c6
Show file tree
Hide file tree
Showing 13 changed files with 86 additions and 21 deletions.
2 changes: 1 addition & 1 deletion deps/zlib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)

project(zlib C)

set(VERSION "1.3")
set(VERSION "1.3.0.1")

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
4 changes: 2 additions & 2 deletions deps/zlib/README.chromium
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Name: zlib
Short Name: zlib
URL: http://zlib.net/
Version: 1.2.13
CPEPrefix: cpe:/a:zlib:zlib:1.2.13
Version: 1.3.0.1
CPEPrefix: cpe:/a:zlib:zlib:1.3.0.1
Security Critical: yes
Shipped: yes
License: Zlib
Expand Down
1 change: 1 addition & 0 deletions deps/zlib/contrib/minizip/README.chromium
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ License: Zlib
License File: //third_party/zlib/LICENSE
Security Critical: yes
Shipped: yes
CPEPrefix: cpe:/a:minizip_project:minizip

Description:
Minizip provides API on top of zlib that can enumerate and extract ZIP archive
Expand Down
2 changes: 1 addition & 1 deletion deps/zlib/contrib/optimizations/inflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1422,7 +1422,7 @@ int ZEXPORT inflateSync(z_streamp strm) {
/* if first time, start search in bit buffer */
if (state->mode != SYNC) {
state->mode = SYNC;
state->hold <<= state->bits & 7;
state->hold >>= state->bits & 7;
state->bits -= state->bits & 7;
len = 0;
while (state->bits >= 8) {
Expand Down
23 changes: 22 additions & 1 deletion deps/zlib/deflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
#endif

const char deflate_copyright[] =
" deflate 1.3 Copyright 1995-2023 Jean-loup Gailly and Mark Adler ";
" deflate 1.3.0.1 Copyright 1995-2023 Jean-loup Gailly and Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
Expand Down Expand Up @@ -531,7 +531,11 @@ int ZEXPORT deflateInit2_(z_streamp strm, int level, int method,
* the compressed data for a dynamic block also cannot overwrite the
* symbols from which it is being constructed.
*/
#ifdef LIT_MEM
s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 5);
#else
s->pending_buf = (uchf *) ZALLOC(strm, s->lit_bufsize, 4);
#endif
s->pending_buf_size = (ulg)s->lit_bufsize * 4;

if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL ||
Expand All @@ -541,8 +545,14 @@ int ZEXPORT deflateInit2_(z_streamp strm, int level, int method,
deflateEnd (strm);
return Z_MEM_ERROR;
}
#ifdef LIT_MEM
s->d_buf = (ushf *)(s->pending_buf + (s->lit_bufsize << 1));
s->l_buf = s->pending_buf + (s->lit_bufsize << 2);
s->sym_end = s->lit_bufsize - 1;
#else
s->sym_buf = s->pending_buf + s->lit_bufsize;
s->sym_end = (s->lit_bufsize - 1) * 3;
#endif
/* We avoid equality with lit_bufsize*3 because of wraparound at 64K
* on 16 bit machines and because stored blocks are restricted to
* 64K-1 bytes.
Expand Down Expand Up @@ -754,9 +764,15 @@ int ZEXPORT deflatePrime(z_streamp strm, int bits, int value) {

if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
s = strm->state;
#ifdef LIT_MEM
if (bits < 0 || bits > 16 ||
(uchf *)s->d_buf < s->pending_out + ((Buf_size + 7) >> 3))
return Z_BUF_ERROR;
#else
if (bits < 0 || bits > 16 ||
s->sym_buf < s->pending_out + ((Buf_size + 7) >> 3))
return Z_BUF_ERROR;
#endif
do {
put = Buf_size - s->bi_valid;
if (put > bits)
Expand Down Expand Up @@ -1343,7 +1359,12 @@ int ZEXPORT deflateCopy(z_streamp dest, z_streamp source) {
zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size);

ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf);
#ifdef LIT_MEM
ds->d_buf = (ushf *)(ds->pending_buf + (ds->lit_bufsize << 1));
ds->l_buf = ds->pending_buf + (ds->lit_bufsize << 2);
#else
ds->sym_buf = ds->pending_buf + ds->lit_bufsize;
#endif

ds->l_desc.dyn_tree = ds->dyn_ltree;
ds->d_desc.dyn_tree = ds->dyn_dtree;
Expand Down
31 changes: 30 additions & 1 deletion deps/zlib/deflate.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
# define GZIP
#endif

/* define LIT_MEM to slightly increase the speed of deflate (order 1% to 2%) at
the cost of a larger memory footprint */
/* #define LIT_MEM */

/* ===========================================================================
* Internal compression state.
*/
Expand Down Expand Up @@ -217,7 +221,12 @@ typedef struct internal_state {
/* Depth of each subtree used as tie breaker for trees of equal frequency
*/

#ifdef LIT_MEM
ushf *d_buf; /* buffer for distances */
uchf *l_buf; /* buffer for literals/lengths */
#else
uchf *sym_buf; /* buffer for distances and literals/lengths */
#endif

uInt lit_bufsize;
/* Size of match buffer for literals/lengths. There are 4 reasons for
Expand All @@ -239,7 +248,7 @@ typedef struct internal_state {
* - I can't count above 4
*/

uInt sym_next; /* running index in sym_buf */
uInt sym_next; /* running index in symbol buffer */
uInt sym_end; /* symbol table full when sym_next reaches this */

ulg opt_len; /* bit length of current block with optimal trees */
Expand Down Expand Up @@ -323,6 +332,25 @@ void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf,
extern const uch ZLIB_INTERNAL _dist_code[];
#endif

#ifdef LIT_MEM
# define _tr_tally_lit(s, c, flush) \
{ uch cc = (c); \
s->d_buf[s->sym_next] = 0; \
s->l_buf[s->sym_next++] = cc; \
s->dyn_ltree[cc].Freq++; \
flush = (s->sym_next == s->sym_end); \
}
# define _tr_tally_dist(s, distance, length, flush) \
{ uch len = (uch)(length); \
ush dist = (ush)(distance); \
s->d_buf[s->sym_next] = dist; \
s->l_buf[s->sym_next++] = len; \
dist--; \
s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
s->dyn_dtree[d_code(dist)].Freq++; \
flush = (s->sym_next == s->sym_end); \
}
#else
# define _tr_tally_lit(s, c, flush) \
{ uch cc = (c); \
s->sym_buf[s->sym_next++] = 0; \
Expand All @@ -342,6 +370,7 @@ void ZLIB_INTERNAL _tr_stored_block(deflate_state *s, charf *buf,
s->dyn_dtree[d_code(dist)].Freq++; \
flush = (s->sym_next == s->sym_end); \
}
#endif
#else
# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
# define _tr_tally_dist(s, distance, length, flush) \
Expand Down
2 changes: 1 addition & 1 deletion deps/zlib/inflate.c
Original file line number Diff line number Diff line change
Expand Up @@ -1389,7 +1389,7 @@ int ZEXPORT inflateSync(z_streamp strm) {
/* if first time, start search in bit buffer */
if (state->mode != SYNC) {
state->mode = SYNC;
state->hold <<= state->bits & 7;
state->hold >>= state->bits & 7;
state->bits -= state->bits & 7;
len = 0;
while (state->bits >= 8) {
Expand Down
4 changes: 2 additions & 2 deletions deps/zlib/inftrees.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define MAXBITS 15

const char inflate_copyright[] =
" inflate 1.3 Copyright 1995-2023 Mark Adler ";
" inflate 1.3.0.1 Copyright 1995-2023 Mark Adler ";
/*
If you use the zlib library in a product, an acknowledgment is welcome
in the documentation of your product. If for some reason you cannot
Expand Down Expand Up @@ -57,7 +57,7 @@ int ZLIB_INTERNAL inflate_table(codetype type, unsigned short FAR *lens,
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 198, 203};
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 70, 200};
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,
Expand Down
18 changes: 16 additions & 2 deletions deps/zlib/trees.c
Original file line number Diff line number Diff line change
Expand Up @@ -899,14 +899,19 @@ local void compress_block(deflate_state *s, const ct_data *ltree,
const ct_data *dtree) {
unsigned dist; /* distance of matched string */
int lc; /* match length or unmatched char (if dist == 0) */
unsigned sx = 0; /* running index in sym_buf */
unsigned sx = 0; /* running index in symbol buffers */
unsigned code; /* the code to send */
int extra; /* number of extra bits to send */

if (s->sym_next != 0) do {
#ifdef LIT_MEM
dist = s->d_buf[sx];
lc = s->l_buf[sx++];
#else
dist = s->sym_buf[sx++] & 0xff;
dist += (unsigned)(s->sym_buf[sx++] & 0xff) << 8;
lc = s->sym_buf[sx++];
#endif
if (dist == 0) {
send_code(s, lc, ltree); /* send a literal byte */
Tracecv(isgraph(lc), (stderr," '%c' ", lc));
Expand All @@ -931,8 +936,12 @@ local void compress_block(deflate_state *s, const ct_data *ltree,
}
} /* literal or match pair ? */

/* Check that the overlay between pending_buf and sym_buf is ok: */
/* Check for no overlay of pending_buf on needed symbols */
#ifdef LIT_MEM
Assert(s->pending < (s->lit_bufsize << 1) + sx, "pendingBuf overflow");
#else
Assert(s->pending < s->lit_bufsize + sx, "pendingBuf overflow");
#endif

} while (sx < s->sym_next);

Expand Down Expand Up @@ -1082,9 +1091,14 @@ void ZLIB_INTERNAL _tr_flush_block(deflate_state *s, charf *buf,
* the current block must be flushed.
*/
int ZLIB_INTERNAL _tr_tally(deflate_state *s, unsigned dist, unsigned lc) {
#ifdef LIT_MEM
s->d_buf[s->sym_next] = (ush)dist;
s->l_buf[s->sym_next++] = (uch)lc;
#else
s->sym_buf[s->sym_next++] = (uch)dist;
s->sym_buf[s->sym_next++] = (uch)(dist >> 8);
s->sym_buf[s->sym_next++] = (uch)lc;
#endif
if (dist == 0) {
/* lc is the unmatched char */
s->dyn_ltree[lc].Freq++;
Expand Down
4 changes: 2 additions & 2 deletions deps/zlib/zlib.3
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.TH ZLIB 3 "xx Oct 2022"
.TH ZLIB 3 "xx Aug 2023"
.SH NAME
zlib \- compression/decompression library
.SH SYNOPSIS
Expand Down Expand Up @@ -105,7 +105,7 @@ before asking for help.
Send questions and/or comments to zlib@gzip.org,
or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
.SH AUTHORS AND LICENSE
Version 1.2.13.1
Version 1.2.3.0.1
.LP
Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler
.LP
Expand Down
8 changes: 4 additions & 4 deletions deps/zlib/zlib.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* zlib.h -- interface of the 'zlib' general purpose compression library
version 1.3, August 18th, 2023
version 1.3.0.1, August xxth, 2023
Copyright (C) 1995-2023 Jean-loup Gailly and Mark Adler
Expand Down Expand Up @@ -37,12 +37,12 @@
extern "C" {
#endif

#define ZLIB_VERSION "1.3"
#define ZLIB_VERNUM 0x1300
#define ZLIB_VERSION "1.3.0.1-motley"
#define ZLIB_VERNUM 0x1301
#define ZLIB_VER_MAJOR 1
#define ZLIB_VER_MINOR 3
#define ZLIB_VER_REVISION 0
#define ZLIB_VER_SUBREVISION 0
#define ZLIB_VER_SUBREVISION 1

/*
The 'zlib' compression library provides in-memory compression and
Expand Down
6 changes: 3 additions & 3 deletions doc/contributing/maintaining/maintaining-dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ This a list of all the dependencies:
* [undici 5.27.2][]
* [uvwasi 0.0.19][]
* [V8 11.3.244.8][]
* [zlib 1.3-22124f5][]
* [zlib 1.3.0.1-motley-dd5fc13][]

Any code which meets one or more of these conditions should
be managed as a dependency:
Expand Down Expand Up @@ -311,7 +311,7 @@ See [maintaining-web-assembly][] for more informations.
high-performance JavaScript and WebAssembly engine, written in C++.
See [maintaining-V8][] for more informations.

### zlib 1.3-22124f5
### zlib 1.3.0.1-motley-dd5fc13

The [zlib](https://chromium.googlesource.com/chromium/src/+/refs/heads/main/third_party/zlib)
dependency lossless data-compression library,
Expand Down Expand Up @@ -349,4 +349,4 @@ performance improvements not currently available in standard zlib.
[update-openssl-action]: ../../../.github/workflows/update-openssl.yml
[uvwasi 0.0.19]: #uvwasi-0019
[v8 11.3.244.8]: #v8-1132448
[zlib 1.3-22124f5]: #zlib-13-22124f5
[zlib 1.3.0.1-motley-dd5fc13]: #zlib-1301-motley-dd5fc13
2 changes: 1 addition & 1 deletion src/zlib_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
// Refer to tools/dep_updaters/update-zlib.sh
#ifndef SRC_ZLIB_VERSION_H_
#define SRC_ZLIB_VERSION_H_
#define ZLIB_VERSION "1.3-22124f5"
#define ZLIB_VERSION "1.3.0.1-motley-dd5fc13"
#endif // SRC_ZLIB_VERSION_H_

0 comments on commit 09519c6

Please sign in to comment.