Skip to content

Commit 1b1bbe4

Browse files
authored
Merge pull request opencv#22801 from alalek:update_zlib
* 3rdparty: zlib 1.2.12 => 1.2.13 https://github.com/madler/zlib/releases/tag/v1.2.13 - replace README -> LICENSE in install distribution * 3rdparty(zlib): re-apply patch 20190330-ununitialized-use-state-check.diff
1 parent b5a68f2 commit 1b1bbe4

21 files changed

+303
-235
lines changed

3rdparty/zlib/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,4 @@ if(NOT BUILD_SHARED_LIBS)
102102
ocv_install_target(${ZLIB_LIBRARY} EXPORT OpenCVModules ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev)
103103
endif()
104104

105-
ocv_install_3rdparty_licenses(zlib README)
105+
ocv_install_3rdparty_licenses(zlib LICENSE)

3rdparty/zlib/ChangeLog

+18-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,18 @@
11

22
ChangeLog file for zlib
33

4+
Changes in 1.2.13 (13 Oct 2022)
5+
- Fix configure issue that discarded provided CC definition
6+
- Correct incorrect inputs provided to the CRC functions
7+
- Repair prototypes and exporting of new CRC functions
8+
- Fix inflateBack to detect invalid input with distances too far
9+
- Have infback() deliver all of the available output up to any error
10+
- Fix a bug when getting a gzip header extra field with inflate()
11+
- Fix bug in block type selection when Z_FIXED used
12+
- Tighten deflateBound bounds
13+
- Remove deleted assembler code references
14+
- Various portability and appearance improvements
15+
416
Changes in 1.2.12 (27 Mar 2022)
517
- Cygwin does not have _wopen(), so do not create gzopen_w() there
618
- Permit a deflateParams() parameter change as soon as possible
@@ -159,7 +171,7 @@ Changes in 1.2.7.1 (24 Mar 2013)
159171
- Fix types in contrib/minizip to match result of get_crc_table()
160172
- Simplify contrib/vstudio/vc10 with 'd' suffix
161173
- Add TOP support to win32/Makefile.msc
162-
- Suport i686 and amd64 assembler builds in CMakeLists.txt
174+
- Support i686 and amd64 assembler builds in CMakeLists.txt
163175
- Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h
164176
- Add vc11 and vc12 build files to contrib/vstudio
165177
- Add gzvprintf() as an undocumented function in zlib
@@ -359,14 +371,14 @@ Changes in 1.2.5.1 (10 Sep 2011)
359371
- Use u4 type for crc_table to avoid conversion warnings
360372
- Apply casts in zlib.h to avoid conversion warnings
361373
- Add OF to prototypes for adler32_combine_ and crc32_combine_ [Miller]
362-
- Improve inflateSync() documentation to note indeterminancy
374+
- Improve inflateSync() documentation to note indeterminacy
363375
- Add deflatePending() function to return the amount of pending output
364376
- Correct the spelling of "specification" in FAQ [Randers-Pehrson]
365377
- Add a check in configure for stdarg.h, use for gzprintf()
366378
- Check that pointers fit in ints when gzprint() compiled old style
367379
- Add dummy name before $(SHAREDLIBV) in Makefile [Bar-Lev, Bowler]
368380
- Delete line in configure that adds -L. libz.a to LDFLAGS [Weigelt]
369-
- Add debug records in assmebler code [Londer]
381+
- Add debug records in assembler code [Londer]
370382
- Update RFC references to use http://tools.ietf.org/html/... [Li]
371383
- Add --archs option, use of libtool to configure for Mac OS X [Borstel]
372384

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

3rdparty/zlib/LICENSE

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Copyright notice:
2+
3+
(C) 1995-2022 Jean-loup Gailly and Mark Adler
4+
5+
This software is provided 'as-is', without any express or implied
6+
warranty. In no event will the authors be held liable for any damages
7+
arising from the use of this software.
8+
9+
Permission is granted to anyone to use this software for any purpose,
10+
including commercial applications, and to alter it and redistribute it
11+
freely, subject to the following restrictions:
12+
13+
1. The origin of this software must not be misrepresented; you must not
14+
claim that you wrote the original software. If you use this software
15+
in a product, an acknowledgment in the product documentation would be
16+
appreciated but is not required.
17+
2. Altered source versions must be plainly marked as such, and must not be
18+
misrepresented as being the original software.
19+
3. This notice may not be removed or altered from any source distribution.
20+
21+
Jean-loup Gailly Mark Adler
22+

3rdparty/zlib/README

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ZLIB DATA COMPRESSION LIBRARY
22

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

34-
The changes made in version 1.2.12 are documented in the file ChangeLog.
34+
The changes made in version 1.2.13 are documented in the file ChangeLog.
3535

3636
Unsupported third party contributions are provided in directory contrib/ .
3737

3rdparty/zlib/compress.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
memory, Z_BUF_ERROR if there was not enough room in the output buffer,
2020
Z_STREAM_ERROR if the level parameter is invalid.
2121
*/
22-
int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
22+
int ZEXPORT compress2(dest, destLen, source, sourceLen, level)
2323
Bytef *dest;
2424
uLongf *destLen;
2525
const Bytef *source;
@@ -65,7 +65,7 @@ int ZEXPORT compress2 (dest, destLen, source, sourceLen, level)
6565

6666
/* ===========================================================================
6767
*/
68-
int ZEXPORT compress (dest, destLen, source, sourceLen)
68+
int ZEXPORT compress(dest, destLen, source, sourceLen)
6969
Bytef *dest;
7070
uLongf *destLen;
7171
const Bytef *source;
@@ -78,7 +78,7 @@ int ZEXPORT compress (dest, destLen, source, sourceLen)
7878
If the default memLevel or windowBits for deflateInit() is changed, then
7979
this function needs to be updated.
8080
*/
81-
uLong ZEXPORT compressBound (sourceLen)
81+
uLong ZEXPORT compressBound(sourceLen)
8282
uLong sourceLen;
8383
{
8484
return sourceLen + (sourceLen >> 12) + (sourceLen >> 14) +

3rdparty/zlib/crc32.c

+21-12
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,22 @@
9898
# endif
9999
#endif
100100

101+
/* If available, use the ARM processor CRC32 instruction. */
102+
#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && W == 8
103+
# define ARMCRC32
104+
#endif
105+
101106
/* Local functions. */
102107
local z_crc_t multmodp OF((z_crc_t a, z_crc_t b));
103108
local z_crc_t x2nmodp OF((z_off64_t n, unsigned k));
104109

105-
/* If available, use the ARM processor CRC32 instruction. */
106-
#if defined(__aarch64__) && defined(__ARM_FEATURE_CRC32) && W == 8
107-
# define ARMCRC32
110+
#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE))
111+
local z_word_t byte_swap OF((z_word_t word));
112+
#endif
113+
114+
#if defined(W) && !defined(ARMCRC32)
115+
local z_crc_t crc_word OF((z_word_t data));
116+
local z_word_t crc_word_big OF((z_word_t data));
108117
#endif
109118

110119
#if defined(W) && (!defined(ARMCRC32) || defined(DYNAMIC_CRC_TABLE))
@@ -630,7 +639,7 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
630639
#endif /* DYNAMIC_CRC_TABLE */
631640

632641
/* Pre-condition the CRC */
633-
crc ^= 0xffffffff;
642+
crc = (~crc) & 0xffffffff;
634643

635644
/* Compute the CRC up to a word boundary. */
636645
while (len && ((z_size_t)buf & 7) != 0) {
@@ -645,8 +654,8 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
645654
len &= 7;
646655

647656
/* Do three interleaved CRCs to realize the throughput of one crc32x
648-
instruction per cycle. Each CRC is calcuated on Z_BATCH words. The three
649-
CRCs are combined into a single CRC after each set of batches. */
657+
instruction per cycle. Each CRC is calculated on Z_BATCH words. The
658+
three CRCs are combined into a single CRC after each set of batches. */
650659
while (num >= 3 * Z_BATCH) {
651660
crc1 = 0;
652661
crc2 = 0;
@@ -749,7 +758,7 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
749758
#endif /* DYNAMIC_CRC_TABLE */
750759

751760
/* Pre-condition the CRC */
752-
crc ^= 0xffffffff;
761+
crc = (~crc) & 0xffffffff;
753762

754763
#ifdef W
755764

@@ -1077,7 +1086,7 @@ uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
10771086
#ifdef DYNAMIC_CRC_TABLE
10781087
once(&made, make_crc_table);
10791088
#endif /* DYNAMIC_CRC_TABLE */
1080-
return multmodp(x2nmodp(len2, 3), crc1) ^ crc2;
1089+
return multmodp(x2nmodp(len2, 3), crc1) ^ (crc2 & 0xffffffff);
10811090
}
10821091

10831092
/* ========================================================================= */
@@ -1086,7 +1095,7 @@ uLong ZEXPORT crc32_combine(crc1, crc2, len2)
10861095
uLong crc2;
10871096
z_off_t len2;
10881097
{
1089-
return crc32_combine64(crc1, crc2, len2);
1098+
return crc32_combine64(crc1, crc2, (z_off64_t)len2);
10901099
}
10911100

10921101
/* ========================================================================= */
@@ -1103,14 +1112,14 @@ uLong ZEXPORT crc32_combine_gen64(len2)
11031112
uLong ZEXPORT crc32_combine_gen(len2)
11041113
z_off_t len2;
11051114
{
1106-
return crc32_combine_gen64(len2);
1115+
return crc32_combine_gen64((z_off64_t)len2);
11071116
}
11081117

11091118
/* ========================================================================= */
1110-
uLong crc32_combine_op(crc1, crc2, op)
1119+
uLong ZEXPORT crc32_combine_op(crc1, crc2, op)
11111120
uLong crc1;
11121121
uLong crc2;
11131122
uLong op;
11141123
{
1115-
return multmodp(op, crc1) ^ crc2;
1124+
return multmodp(op, crc1) ^ (crc2 & 0xffffffff);
11161125
}

0 commit comments

Comments
 (0)