Skip to content
Open
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
394 changes: 253 additions & 141 deletions deps/zlib/CMakeLists.txt

Large diffs are not rendered by default.

33 changes: 18 additions & 15 deletions deps/zlib/LICENSE
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
version 1.2.12, March 27th, 2022
Copyright notice:

Copyright (C) 1995-2022 Jean-loup Gailly and Mark Adler
(C) 1995-2026 Jean-loup Gailly and Mark Adler

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu
115 changes: 115 additions & 0 deletions deps/zlib/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
ZLIB DATA COMPRESSION LIBRARY

zlib 1.3.2.1 is a general purpose data compression library. All the code is
thread safe (though see the FAQ for caveats). The data format used by the zlib
library is described by RFCs (Request for Comments) 1950 to 1952 at
https://datatracker.ietf.org/doc/html/rfc1950 (zlib format), rfc1951 (deflate
format) and rfc1952 (gzip format).

All functions of the compression library are documented in the file zlib.h
(volunteer to write man pages welcome, contact zlib@gzip.org). A usage example
of the library is given in the file test/example.c which also tests that
the library is working correctly. Another example is given in the file
test/minigzip.c. The compression library itself is composed of all source
files in the root directory.

To compile all files and run the test program, follow the instructions given at
the top of Makefile.in. In short "./configure; make test", and if that goes
well, "make install" should work for most flavors of Unix. For Windows, use
one of the special makefiles in win32/ or contrib/vstudio/ . For VMS, use
make_vms.com.

Questions about zlib should be sent to <zlib@gzip.org>, or to Gilles Vollant
<info@winimage.com> for the Windows DLL version. The zlib home page is
https://zlib.net/ . Before reporting a problem, please check this site to
verify that you have the latest version of zlib; otherwise get the latest
version and check whether the problem still exists or not.

PLEASE read the zlib FAQ https://zlib.net/zlib_faq.html before asking for help.

Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
issue of Dr. Dobb's Journal; a copy of the article is available at
https://zlib.net/nelson/ .

The changes made in version 1.3.2.1 are documented in the file ChangeLog.

Unsupported third party contributions are provided in directory contrib/ .

zlib is available in Java using the java.util.zip package. Follow the API
Documentation link at: https://docs.oracle.com/search/?q=java.util.zip .

A Perl interface to zlib and bzip2 written by Paul Marquess <pmqs@cpan.org>
can be found at https://github.com/pmqs/IO-Compress .

A Python interface to zlib written by A.M. Kuchling <amk@amk.ca> is
available in Python 1.5 and later versions, see
https://docs.python.org/3/library/zlib.html .

zlib is built into tcl: https://wiki.tcl-lang.org/page/zlib .

An experimental package to read and write files in .zip format, written on top
of zlib by Gilles Vollant <info@winimage.com>, is available in the
contrib/minizip directory of zlib.


Notes for some targets:

- For Windows DLL versions, please see win32/DLL_FAQ.txt

- For 64-bit Irix, deflate.c must be compiled without any optimization. With
-O, one libpng test fails. The test works in 32 bit mode (with the -n32
compiler flag). The compiler bug has been reported to SGI.

- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1 it works
when compiled with cc.

- On Digital Unix 4.0D (formerly OSF/1) on AlphaServer, the cc option -std1 is
necessary to get gzprintf working correctly. This is done by configure.

- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works with
other compilers. Use "make test" to check your compiler.

- For PalmOs, see https://palmzlib.sourceforge.net/


Acknowledgments:

The deflate format used by zlib was defined by Phil Katz. The deflate and
zlib specifications were written by L. Peter Deutsch. Thanks to all the
people who reported problems and suggested various improvements in zlib; they
are too numerous to cite here.

Copyright notice:

(C) 1995-2026 Jean-loup Gailly and Mark Adler

This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.

Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:

1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.

Jean-loup Gailly Mark Adler
jloup@gzip.org madler@alumni.caltech.edu

If you use the zlib library in a product, we would appreciate *not* receiving
lengthy legal documents to sign. The sources are provided for free but without
warranty of any kind. The library has been entirely written by Jean-loup
Gailly and Mark Adler; it does not include third-party code. We make all
contributions to and distributions of this project solely in our personal
capacity, and are not conveying any rights to any intellectual property of
any third parties.

If you redistribute modified sources, we would appreciate that you include in
the file ChangeLog history information documenting your changes. Please read
the FAQ for more information on the distribution of modified source versions.
8 changes: 4 additions & 4 deletions deps/zlib/README.chromium
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Name: zlib
Short Name: zlib
URL: https://github.com/madler/zlib
Version: 1.3.1
Revision: 51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf
Version: 1.3.2
Revision: 09a1572aa624e5ddb6c075dc013880de70b1b9b9
Update Mechanism: Manual (https://crbug.com/422348588)
CPEPrefix: cpe:/a:zlib:zlib:1.3.1
CPEPrefix: cpe:/a:zlib:zlib:1.3.2
Security Critical: yes
Shipped: yes
License: Zlib
Expand Down Expand Up @@ -33,6 +33,6 @@ Local Modifications:
- Plus the changes in 'patches' folder.
- Code in contrib/ other than contrib/minizip was added to match zlib's
contributor layout.
- In sync with 1.3.1 official release
- In sync with 1.3.2 official release
- ZIP reader modified to allow for progress callbacks during extraction.
- ZIP reader modified to add detection of AES encrypted content.
10 changes: 9 additions & 1 deletion deps/zlib/chromeconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,20 @@
#define adler32_z Cr_z_adler32_z
#define compress Cr_z_compress
#define compress2 Cr_z_compress2
#define compress_z Cr_z_compress_z
#define compress2_z Cr_z_compress2_z
#define compressBound Cr_z_compressBound
#define compressBound_z Cr_z_compressBound_z
#define crc32 Cr_z_crc32
#define crc32_combine Cr_z_crc32_combine
#define crc32_combine64 Cr_z_crc32_combine64
#define crc32_combine_gen64 Cr_z_crc32_combine_gen64
#define crc32_combine_gen Cr_z_crc32_combine_gen
#define crc32_combine_gen64 Cr_z_crc32_combine_gen64
#define crc32_combine_op Cr_z_crc32_combine_op
#define crc32_z Cr_z_crc32_z
#define deflate Cr_z_deflate
#define deflateBound Cr_z_deflateBound
#define deflateBound_z Cr_z_deflateBound_z
#define deflateCopy Cr_z_deflateCopy
#define deflateEnd Cr_z_deflateEnd
#define deflateGetDictionary Cr_z_deflateGetDictionary
Expand All @@ -70,6 +74,7 @@
#define deflateSetDictionary Cr_z_deflateSetDictionary
#define deflateSetHeader Cr_z_deflateSetHeader
#define deflateTune Cr_z_deflateTune
#define deflateUsed Cr_z_deflateUsed
#define deflate_copyright Cr_z_deflate_copyright
#define get_crc_table Cr_z_get_crc_table
#define gz_error Cr_z_gz_error
Expand Down Expand Up @@ -135,8 +140,11 @@
#define inflate_copyright Cr_z_inflate_copyright
#define inflate_fast Cr_z_inflate_fast
#define inflate_table Cr_z_inflate_table
#define inflate_fixed Cr_z_inflate_fixed
#define uncompress Cr_z_uncompress
#define uncompress2 Cr_z_uncompress2
#define uncompress_z Cr_z_uncompress_z
#define uncompress2_z Cr_z_uncompress2_z
#define zError Cr_z_zError
#define zcalloc Cr_z_zcalloc
#define zcfree Cr_z_zcfree
Expand Down
51 changes: 38 additions & 13 deletions deps/zlib/compress.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* compress.c -- compress a memory buffer
* Copyright (C) 1995-2005, 2014, 2016 Jean-loup Gailly, Mark Adler
* Copyright (C) 1995-2026 Jean-loup Gailly, Mark Adler
* For conditions of distribution and use, see copyright notice in zlib.h
*/

Expand All @@ -18,13 +18,19 @@
compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
Z_STREAM_ERROR if the level parameter is invalid.

The _z versions of the functions take size_t length arguments.
*/
int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,
uLong sourceLen, int level) {
int ZEXPORT compress2_z(Bytef *dest, z_size_t *destLen, const Bytef *source,
z_size_t sourceLen, int level) {
z_stream stream;
int err;
const uInt max = (uInt)-1;
uLong left;
z_size_t left;

if ((sourceLen > 0 && source == NULL) ||
destLen == NULL || (*destLen > 0 && dest == NULL))
return Z_STREAM_ERROR;

left = *destLen;
*destLen = 0;
Expand All @@ -43,23 +49,36 @@ int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,

do {
if (stream.avail_out == 0) {
stream.avail_out = left > (uLong)max ? max : (uInt)left;
stream.avail_out = left > (z_size_t)max ? max : (uInt)left;
left -= stream.avail_out;
}
if (stream.avail_in == 0) {
stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen;
stream.avail_in = sourceLen > (z_size_t)max ? max :
(uInt)sourceLen;
sourceLen -= stream.avail_in;
}
err = deflate(&stream, sourceLen ? Z_NO_FLUSH : Z_FINISH);
} while (err == Z_OK);

*destLen = stream.total_out;
*destLen = (z_size_t)(stream.next_out - dest);
deflateEnd(&stream);
return err == Z_STREAM_END ? Z_OK : err;
}

int ZEXPORT compress2(Bytef *dest, uLongf *destLen, const Bytef *source,
uLong sourceLen, int level) {
int ret;
z_size_t got = *destLen;
ret = compress2_z(dest, &got, source, sourceLen, level);
*destLen = (uLong)got;
return ret;
}
/* ===========================================================================
*/
int ZEXPORT compress_z(Bytef *dest, z_size_t *destLen, const Bytef *source,
z_size_t sourceLen) {
return compress2_z(dest, destLen, source, sourceLen,
Z_DEFAULT_COMPRESSION);
}
int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source,
uLong sourceLen) {
return compress2(dest, destLen, source, sourceLen, Z_DEFAULT_COMPRESSION);
Expand All @@ -69,9 +88,10 @@ int ZEXPORT compress(Bytef *dest, uLongf *destLen, const Bytef *source,
If the default memLevel or windowBits for deflateInit() is changed, then
this function needs to be updated.
*/
uLong ZEXPORT compressBound(uLong sourceLen) {
sourceLen = sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
(sourceLen >> 25) + 13;
z_size_t ZEXPORT compressBound_z(z_size_t sourceLen) {
z_size_t bound = sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +
(sourceLen >> 25) + 13;

/* FIXME(cavalcantii): usage of CRC32 Castagnoli as a hash function
* for the hash table of symbols used for compression has a side effect
* where for compression level [4, 5] it will increase the output buffer size
Expand All @@ -80,6 +100,11 @@ uLong ZEXPORT compressBound(uLong sourceLen) {
* the expected output size by 0.8% (i.e. 8x more than the worst scenario).
* See: http://crbug.com/990489
*/
sourceLen += sourceLen >> 7; // Equivalent to 1.0078125
return sourceLen;
bound += bound >> 7; // Equivalent to 1.0078125

return bound < sourceLen ? (z_size_t)-1 : bound;
}
uLong ZEXPORT compressBound(uLong sourceLen) {
z_size_t bound = compressBound_z(sourceLen);
return (uLong)bound != bound ? (uLong)-1 : (uLong)bound;
}
10 changes: 3 additions & 7 deletions deps/zlib/contrib/minizip/Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
CC?=cc
CFLAGS := -O $(CFLAGS) -I../..
CPPFLAGS = -I../..

UNZ_OBJS = miniunz.o unzip.o ioapi.o ../../libz.a
ZIP_OBJS = minizip.o zip.o ioapi.o ../../libz.a

.c.o:
$(CC) -c $(CFLAGS) $*.c

all: miniunz minizip

miniunz.o: miniunz.c unzip.h iowin32.h
Expand All @@ -18,10 +14,10 @@ iowin32.o: iowin32.c iowin32.h ioapi.h
mztools.o: mztools.c unzip.h

miniunz: $(UNZ_OBJS)
$(CC) $(CFLAGS) -o $@ $(UNZ_OBJS)
${CC} ${LDFLAGS} -o $@ $(UNZ_OBJS)

minizip: $(ZIP_OBJS)
$(CC) $(CFLAGS) -o $@ $(ZIP_OBJS)
${CC} ${LDFLAGS} -o $@ $(ZIP_OBJS)

test: miniunz minizip
@rm -f test.*
Expand Down
7 changes: 5 additions & 2 deletions deps/zlib/contrib/minizip/README.chromium
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Name: ZIP file API for reading file entries in a ZIP archive
Short Name: minizip
URL: https://github.com/madler/zlib/tree/master/contrib/minizip
Version: 1.3.1.1
Revision: ef24c4c7502169f016dcd2a26923dbaf3216748c
Version: 1.3.2
Revision: 09a1572aa624e5ddb6c075dc013880de70b1b9b9
Update Mechanism: Manual
License: Zlib
License File: //third_party/zlib/LICENSE
Expand Down Expand Up @@ -40,3 +40,6 @@ Local Modifications:
large CRX files).
0018-support-prefixed-zip64.patch

- Added stricter parsing for zip64 candidates to avoid an issue where a zip64
could be embedded in a non-zip64 zip.
0019-fix-zip64-in-zip.patch
11 changes: 4 additions & 7 deletions deps/zlib/contrib/minizip/crypt.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
/* crypt.h -- base code for crypt/uncrypt ZIPfile


Version 1.01e, February 12th, 2005

Copyright (C) 1998-2005 Gilles Vollant
Copyright (C) 1998-2026 Gilles Vollant

This code is a modified version of crypting code in Infozip distribution

Expand All @@ -23,7 +20,7 @@
This code support the "Traditional PKWARE Encryption".

The new AES encryption added on Zip format by Winzip (see the page
http://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong
https://www.winzip.com/aes_info.htm ) and PKWare PKZip 5.x Strong
Encryption is not supported.
*/

Expand All @@ -50,7 +47,7 @@ static int update_keys(unsigned long* pkeys, const z_crc_t* pcrc_32_tab, int c)
(*(pkeys+1)) += (*(pkeys+0)) & 0xff;
(*(pkeys+1)) = (*(pkeys+1)) * 134775813L + 1;
{
register int keyshift = (int)((*(pkeys+1)) >> 24);
int keyshift = (int)((*(pkeys+1)) >> 24);
(*(pkeys+2)) = CRC32((*(pkeys+2)), keyshift);
}
return c;
Expand Down Expand Up @@ -106,7 +103,7 @@ static unsigned crypthead(const char* passwd, /* password string */
*/
if (++calls == 1)
{
srand((unsigned)(time(NULL) ^ ZCR_SEED2));
srand((unsigned)time(NULL) ^ ZCR_SEED2);
}
init_keys(passwd, pkeys, pcrc_32_tab);
for (n = 0; n < RAND_HEAD_LEN-2; n++)
Expand Down
Loading