Rebase to version 1.2.13

Patches 21,24,25 has been upstreamed

Resolves: #2134894
This commit is contained in:
Lukas Javorsky 2022-10-17 14:31:23 +00:00
parent de5caa002f
commit d7912252c7
10 changed files with 207 additions and 1820 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/zlib-1.2.11.tar.xz /zlib-1.2.11.tar.xz
/zlib-1.2.12.tar.gz /zlib-1.2.12.tar.gz
/zlib-1.2.12.tar.xz /zlib-1.2.12.tar.xz
/zlib-1.2.13.tar.xz

View File

@ -1 +1 @@
SHA512 (zlib-1.2.12.tar.xz) = 12940e81e988f7661da52fa20bdc333314ae86a621fdb748804a20840b065a1d6d984430f2d41f3a057de0effc6ff9bcf42f9ee9510b88219085f59cbbd082bd SHA512 (zlib-1.2.13.tar.xz) = 9e7ac71a1824855ae526506883e439456b74ac0b811d54e94f6908249ba8719bec4c8d7672903c5280658b26cb6b5e93ecaaafe5cdc2980c760fa196773f0725

View File

@ -1,54 +0,0 @@
From ec3df00224d4b396e2ac6586ab5d25f673caa4c2 Mon Sep 17 00:00:00 2001
From: Mark Adler <madler@alumni.caltech.edu>
Date: Wed, 30 Mar 2022 11:14:53 -0700
Subject: [PATCH] Correct incorrect inputs provided to the CRC functions.
The previous releases of zlib were not sensitive to incorrect CRC
inputs with bits set above the low 32. This commit restores that
behavior, so that applications with such bugs will continue to
operate as before.
---
crc32.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/crc32.c b/crc32.c
index a1bdce5..451887b 100644
--- a/crc32.c
+++ b/crc32.c
@@ -630,7 +630,7 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
#endif /* DYNAMIC_CRC_TABLE */
/* Pre-condition the CRC */
- crc ^= 0xffffffff;
+ crc = (~crc) & 0xffffffff;
/* Compute the CRC up to a word boundary. */
while (len && ((z_size_t)buf & 7) != 0) {
@@ -749,7 +749,7 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
#endif /* DYNAMIC_CRC_TABLE */
/* Pre-condition the CRC */
- crc ^= 0xffffffff;
+ crc = (~crc) & 0xffffffff;
#ifdef W
@@ -1077,7 +1077,7 @@ uLong ZEXPORT crc32_combine64(crc1, crc2, len2)
#ifdef DYNAMIC_CRC_TABLE
once(&made, make_crc_table);
#endif /* DYNAMIC_CRC_TABLE */
- return multmodp(x2nmodp(len2, 3), crc1) ^ crc2;
+ return multmodp(x2nmodp(len2, 3), crc1) ^ (crc2 & 0xffffffff);
}
/* ========================================================================= */
@@ -1112,5 +1112,5 @@ uLong crc32_combine_op(crc1, crc2, op)
uLong crc2;
uLong op;
{
- return multmodp(op, crc1) ^ crc2;
+ return multmodp(op, crc1) ^ (crc2 & 0xffffffff);
}
--
2.34.3

View File

@ -1,14 +0,0 @@
--- zlib-1.2.12/inflate.c.old 2022-08-09 10:30:18.831225181 +0000
+++ zlib-1.2.12/inflate.c 2022-08-09 10:29:33.251225181 +0000
@@ -792,8 +792,9 @@ int flush;
if (copy > have) copy = have;
if (copy) {
if (state->head != Z_NULL &&
- state->head->extra != Z_NULL) {
- len = state->head->extra_len - state->length;
+ state->head->extra != Z_NULL &&
+ (len = state->head->extra_len - state->length) <
+ state->head->extra_max) {
zmemcpy(state->head->extra + len, next,
len + copy > state->head->extra_max ?
state->head->extra_max - len : copy);

View File

@ -1,46 +0,0 @@
From a6cd9e1230acdb535bd57bbc350020da3d24eaf3 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Mon, 28 Mar 2022 08:40:45 +0100
Subject: [PATCH] Fix CC logic in configure
In https://github.com/madler/zlib/commit/e9a52aa129efe3834383e415580716a7c4027f8d,
the logic was changed to try check harder for GCC, but it dropped
the default setting of cc=${CC}. It was throwing away any pre-set CC value as
a result.
The rest of the script then cascades down a bad path because it's convinced
it's not GCC or a GCC-like compiler.
This led to e.g. misdetection of inability to build shared libs
for say, multilib cases (w/ CC being one thing from the environment being used
for one test (e.g. x86_64-unknown-linux-gnu-gcc -m32 and then 'cc' used for
shared libs (but missing "-m32"!)). Obviously just one example of how
the old logic could break.
This restores the old default of 'CC' if nothing overrides it later
in configure.
Bug: https://bugs.gentoo.org/836308
Signed-off-by: Sam James <sam@gentoo.org>
---
configure | 3 +++
1 file changed, 3 insertions(+)
diff --git a/configure b/configure
index a21be36..cdf0e5b 100755
--- a/configure
+++ b/configure
@@ -185,7 +185,10 @@ if test -z "$CC"; then
else
cc=${CROSS_PREFIX}cc
fi
+else
+ cc=${CC}
fi
+
cflags=${CFLAGS-"-O3"}
# to force the asm version use: CFLAGS="-O3 -DASMV" ./configure
case "$cc" in
--
2.34.3

View File

@ -1,4 +1,4 @@
From e6aed68ff815be74855ec6a19d6ae35065a4adb4 Mon Sep 17 00:00:00 2001 From 48c5416a4e21227b8e1aa24fd819d4619a90e1a9 Mon Sep 17 00:00:00 2001
From: Ilya Leoshkevich <iii@linux.ibm.com> From: Ilya Leoshkevich <iii@linux.ibm.com>
Date: Wed, 18 Jul 2018 13:14:07 +0200 Date: Wed, 18 Jul 2018 13:14:07 +0200
Subject: [PATCH] Add support for IBM Z hardware-accelerated deflate Subject: [PATCH] Add support for IBM Z hardware-accelerated deflate
@ -100,10 +100,10 @@ updatewindow and made ZLIB_INTERNAL.
configure | 24 + configure | 24 +
contrib/README.contrib | 4 + contrib/README.contrib | 4 +
contrib/s390/README.txt | 17 + contrib/s390/README.txt | 17 +
contrib/s390/dfltcc.c | 996 ++++++++++++++++++++++++++++++++++ contrib/s390/dfltcc.c | 995 ++++++++++++++++++++++++++++++++++
contrib/s390/dfltcc.h | 81 +++ contrib/s390/dfltcc.h | 81 +++
contrib/s390/dfltcc_deflate.h | 55 ++ contrib/s390/dfltcc_deflate.h | 55 ++
deflate.c | 81 ++- deflate.c | 82 ++-
deflate.h | 12 + deflate.h | 12 +
gzguts.h | 4 + gzguts.h | 4 +
inflate.c | 87 ++- inflate.c | 87 ++-
@ -119,10 +119,10 @@ updatewindow and made ZLIB_INTERNAL.
create mode 100644 contrib/s390/dfltcc_deflate.h create mode 100644 contrib/s390/dfltcc_deflate.h
diff --git a/Makefile.in b/Makefile.in diff --git a/Makefile.in b/Makefile.in
index fd28bbfbf..66e3a8057 100644 index 408954d..a811c10 100644
--- a/Makefile.in --- a/Makefile.in
+++ b/Makefile.in +++ b/Makefile.in
@@ -143,6 +143,14 @@ match.lo: match.S @@ -139,6 +139,14 @@ match.lo: match.S
mv _match.o match.lo mv _match.o match.lo
rm -f _match.s rm -f _match.s
@ -134,11 +134,11 @@ index fd28bbfbf..66e3a8057 100644
+ $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/dfltcc.o $(SRCDIR)contrib/s390/dfltcc.c + $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/dfltcc.o $(SRCDIR)contrib/s390/dfltcc.c
+ -@mv objs/dfltcc.o $@ + -@mv objs/dfltcc.o $@
+ +
example.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h crc32_test.o: $(SRCDIR)test/crc32_test.c $(SRCDIR)zlib.h zconf.h
$(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/example.c $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/crc32_test.c
diff --git a/compress.c b/compress.c diff --git a/compress.c b/compress.c
index e2db404ab..78fc6568f 100644 index 2ad5326..179ee27 100644
--- a/compress.c --- a/compress.c
+++ b/compress.c +++ b/compress.c
@@ -5,9 +5,15 @@ @@ -5,9 +5,15 @@
@ -158,8 +158,8 @@ index e2db404ab..78fc6568f 100644
/* =========================================================================== /* ===========================================================================
Compresses the source buffer into the destination buffer. The level Compresses the source buffer into the destination buffer. The level
parameter has the same meaning as in deflateInit. sourceLen is the byte parameter has the same meaning as in deflateInit. sourceLen is the byte
@@ -81,6 +87,12 @@ int ZEXPORT compress (dest, destLen, source, sourceLen) @@ -81,6 +87,12 @@ int ZEXPORT compress(dest, destLen, source, sourceLen)
uLong ZEXPORT compressBound (sourceLen) uLong ZEXPORT compressBound(sourceLen)
uLong sourceLen; uLong sourceLen;
{ {
+ uLong complen = DEFLATE_BOUND_COMPLEN(sourceLen); + uLong complen = DEFLATE_BOUND_COMPLEN(sourceLen);
@ -172,10 +172,10 @@ index e2db404ab..78fc6568f 100644
(sourceLen >> 25) + 13; (sourceLen >> 25) + 13;
} }
diff --git a/configure b/configure diff --git a/configure b/configure
index 3fa3e8618..cdf0e5b6b 100755 index 45d51e5..ab3204a 100755
--- a/configure --- a/configure
+++ b/configure +++ b/configure
@@ -115,6 +115,7 @@ case "$1" in @@ -118,6 +118,7 @@ case "$1" in
echo ' configure [--const] [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log echo ' configure [--const] [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | tee -a configure.log
echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log echo ' [--static] [--64] [--libdir=LIBDIR] [--sharedlibdir=LIBDIR]' | tee -a configure.log
echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log echo ' [--includedir=INCLUDEDIR] [--archs="-arch i386 -arch x86_64"]' | tee -a configure.log
@ -183,7 +183,7 @@ index 3fa3e8618..cdf0e5b6b 100755
exit 0 ;; exit 0 ;;
-p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;; -p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;;
-e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;; -e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;;
@@ -139,6 +140,16 @@ case "$1" in @@ -142,6 +143,16 @@ case "$1" in
-w* | --warn) warn=1; shift ;; -w* | --warn) warn=1; shift ;;
-d* | --debug) debug=1; shift ;; -d* | --debug) debug=1; shift ;;
--sanitize) sanitize=1; shift ;; --sanitize) sanitize=1; shift ;;
@ -200,7 +200,7 @@ index 3fa3e8618..cdf0e5b6b 100755
*) *)
echo "unknown option: $1" | tee -a configure.log echo "unknown option: $1" | tee -a configure.log
echo "$0 --help for help" | tee -a configure.log echo "$0 --help for help" | tee -a configure.log
@@ -836,6 +847,19 @@ EOF @@ -828,6 +839,19 @@ EOF
fi fi
fi fi
@ -217,14 +217,14 @@ index 3fa3e8618..cdf0e5b6b 100755
+ echo "Checking for sys/sdt.h ... No." | tee -a configure.log + echo "Checking for sys/sdt.h ... No." | tee -a configure.log
+fi +fi
+ +
# show the results in the log # test to see if we can use a gnu indirection function to detect and load optimized code at runtime
echo >> configure.log echo >> configure.log
echo ALL = $ALL >> configure.log cat > $test.c <<EOF
diff --git a/contrib/README.contrib b/contrib/README.contrib diff --git a/contrib/README.contrib b/contrib/README.contrib
index 335e43508..130a28bdb 100644 index 90170df..a36d404 100644
--- a/contrib/README.contrib --- a/contrib/README.contrib
+++ b/contrib/README.contrib +++ b/contrib/README.contrib
@@ -46,6 +46,10 @@ puff/ by Mark Adler <madler@alumni.caltech.edu> @@ -55,6 +55,10 @@ puff/ by Mark Adler <madler@alumni.caltech.edu>
Small, low memory usage inflate. Also serves to provide an Small, low memory usage inflate. Also serves to provide an
unambiguous description of the deflate format. unambiguous description of the deflate format.
@ -237,7 +237,7 @@ index 335e43508..130a28bdb 100644
diff --git a/contrib/s390/README.txt b/contrib/s390/README.txt diff --git a/contrib/s390/README.txt b/contrib/s390/README.txt
new file mode 100644 new file mode 100644
index 000000000..48be008bd index 0000000..48be008
--- /dev/null --- /dev/null
+++ b/contrib/s390/README.txt +++ b/contrib/s390/README.txt
@@ -0,0 +1,17 @@ @@ -0,0 +1,17 @@
@ -260,10 +260,10 @@ index 000000000..48be008bd
+DFLTCC_LEVEL_MASK to 0x7e at run time. +DFLTCC_LEVEL_MASK to 0x7e at run time.
diff --git a/contrib/s390/dfltcc.c b/contrib/s390/dfltcc.c diff --git a/contrib/s390/dfltcc.c b/contrib/s390/dfltcc.c
new file mode 100644 new file mode 100644
index 000000000..fe81bebfe index 0000000..aa0b7a3
--- /dev/null --- /dev/null
+++ b/contrib/s390/dfltcc.c +++ b/contrib/s390/dfltcc.c
@@ -0,0 +1,996 @@ @@ -0,0 +1,995 @@
+/* dfltcc.c - SystemZ DEFLATE CONVERSION CALL support. */ +/* dfltcc.c - SystemZ DEFLATE CONVERSION CALL support. */
+ +
+/* +/*
@ -890,7 +890,7 @@ index 000000000..fe81bebfe
+ state->bits = param->sbb; + state->bits = param->sbb;
+ state->whave = param->hl; + state->whave = param->hl;
+ state->wnext = (param->ho + param->hl) & ((1 << HB_BITS) - 1); + state->wnext = (param->ho + param->hl) & ((1 << HB_BITS) - 1);
+ state->check = state->flags ? ZSWAP32(param->cv) : param->cv; + strm->adler = state->check = state->flags ? ZSWAP32(param->cv) : param->cv;
+ if (cc == DFLTCC_CC_OP2_CORRUPT && param->oesc != 0) { + if (cc == DFLTCC_CC_OP2_CORRUPT && param->oesc != 0) {
+ /* Report an error if stream is corrupted */ + /* Report an error if stream is corrupted */
+ state->mode = BAD; + state->mode = BAD;
@ -968,7 +968,6 @@ index 000000000..fe81bebfe
+__attribute__((constructor)) local void init_globals OF((void)); +__attribute__((constructor)) local void init_globals OF((void));
+__attribute__((constructor)) local void init_globals(void) +__attribute__((constructor)) local void init_globals(void)
+{ +{
+ const char *endptr;
+ const char *env; + const char *env;
+ register char r0 __asm__("r0"); + register char r0 __asm__("r0");
+ +
@ -1262,7 +1261,7 @@ index 000000000..fe81bebfe
+} +}
diff --git a/contrib/s390/dfltcc.h b/contrib/s390/dfltcc.h diff --git a/contrib/s390/dfltcc.h b/contrib/s390/dfltcc.h
new file mode 100644 new file mode 100644
index 000000000..da26612ca index 0000000..da26612
--- /dev/null --- /dev/null
+++ b/contrib/s390/dfltcc.h +++ b/contrib/s390/dfltcc.h
@@ -0,0 +1,81 @@ @@ -0,0 +1,81 @@
@ -1349,7 +1348,7 @@ index 000000000..da26612ca
+#endif +#endif
diff --git a/contrib/s390/dfltcc_deflate.h b/contrib/s390/dfltcc_deflate.h diff --git a/contrib/s390/dfltcc_deflate.h b/contrib/s390/dfltcc_deflate.h
new file mode 100644 new file mode 100644
index 000000000..46acfc550 index 0000000..46acfc5
--- /dev/null --- /dev/null
+++ b/contrib/s390/dfltcc_deflate.h +++ b/contrib/s390/dfltcc_deflate.h
@@ -0,0 +1,55 @@ @@ -0,0 +1,55 @@
@ -1409,7 +1408,7 @@ index 000000000..46acfc550
+ +
+#endif +#endif
diff --git a/deflate.c b/deflate.c diff --git a/deflate.c b/deflate.c
index 6ac891d7d..afca18ce2 100644 index 4a689db..9fd3bdb 100644
--- a/deflate.c --- a/deflate.c
+++ b/deflate.c +++ b/deflate.c
@@ -61,15 +61,30 @@ const char deflate_copyright[] = @@ -61,15 +61,30 @@ const char deflate_copyright[] =
@ -1456,9 +1455,9 @@ index 6ac891d7d..afca18ce2 100644
local void putShortMSB OF((deflate_state *s, uInt b)); local void putShortMSB OF((deflate_state *s, uInt b));
-local void flush_pending OF((z_streamp strm)); -local void flush_pending OF((z_streamp strm));
local unsigned read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); local unsigned read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
#ifdef ASMV local uInt longest_match OF((deflate_state *s, IPos cur_match));
# pragma message("Assembler code may have bugs -- use at your own risk")
@@ -299,7 +313,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, @@ -295,7 +309,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
return Z_STREAM_ERROR; return Z_STREAM_ERROR;
} }
if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */ if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */
@ -1467,16 +1466,16 @@ index 6ac891d7d..afca18ce2 100644
if (s == Z_NULL) return Z_MEM_ERROR; if (s == Z_NULL) return Z_MEM_ERROR;
strm->state = (struct internal_state FAR *)s; strm->state = (struct internal_state FAR *)s;
s->strm = strm; s->strm = strm;
@@ -316,7 +330,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, @@ -312,7 +326,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
s->hash_mask = s->hash_size - 1; s->hash_mask = s->hash_size - 1;
s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); s->hash_shift = ((s->hash_bits + MIN_MATCH-1) / MIN_MATCH);
- s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); - s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte));
+ s->window = (Bytef *) ZALLOC_WINDOW(strm, s->w_size, 2*sizeof(Byte)); + s->window = (Bytef *) ZALLOC_WINDOW(strm, s->w_size, 2*sizeof(Byte));
s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos));
@@ -434,6 +448,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) @@ -430,6 +444,7 @@ int ZEXPORT deflateSetDictionary(strm, dictionary, dictLength)
/* when using zlib wrappers, compute Adler-32 for provided dictionary */ /* when using zlib wrappers, compute Adler-32 for provided dictionary */
if (wrap == 1) if (wrap == 1)
strm->adler = adler32(strm->adler, dictionary, dictLength); strm->adler = adler32(strm->adler, dictionary, dictLength);
@ -1484,7 +1483,7 @@ index 6ac891d7d..afca18ce2 100644
s->wrap = 0; /* avoid computing Adler-32 in read_buf */ s->wrap = 0; /* avoid computing Adler-32 in read_buf */
/* if dictionary would fill window, just replace the history */ /* if dictionary would fill window, just replace the history */
@@ -492,6 +507,7 @@ int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength) @@ -488,6 +503,7 @@ int ZEXPORT deflateGetDictionary(strm, dictionary, dictLength)
if (deflateStateCheck(strm)) if (deflateStateCheck(strm))
return Z_STREAM_ERROR; return Z_STREAM_ERROR;
@ -1492,7 +1491,7 @@ index 6ac891d7d..afca18ce2 100644
s = strm->state; s = strm->state;
len = s->strstart + s->lookahead; len = s->strstart + s->lookahead;
if (len > s->w_size) if (len > s->w_size)
@@ -538,6 +554,8 @@ int ZEXPORT deflateResetKeep (strm) @@ -534,6 +550,8 @@ int ZEXPORT deflateResetKeep(strm)
_tr_init(s); _tr_init(s);
@ -1501,7 +1500,7 @@ index 6ac891d7d..afca18ce2 100644
return Z_OK; return Z_OK;
} }
@@ -613,6 +631,7 @@ int ZEXPORT deflateParams(strm, level, strategy) @@ -609,6 +627,7 @@ int ZEXPORT deflateParams(strm, level, strategy)
{ {
deflate_state *s; deflate_state *s;
compress_func func; compress_func func;
@ -1509,7 +1508,7 @@ index 6ac891d7d..afca18ce2 100644
if (deflateStateCheck(strm)) return Z_STREAM_ERROR; if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
s = strm->state; s = strm->state;
@@ -625,15 +644,18 @@ int ZEXPORT deflateParams(strm, level, strategy) @@ -621,15 +640,18 @@ int ZEXPORT deflateParams(strm, level, strategy)
if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) { if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {
return Z_STREAM_ERROR; return Z_STREAM_ERROR;
} }
@ -1532,25 +1531,31 @@ index 6ac891d7d..afca18ce2 100644
return Z_BUF_ERROR; return Z_BUF_ERROR;
} }
if (s->level != level) { if (s->level != level) {
@@ -700,6 +722,7 @@ uLong ZEXPORT deflateBound(strm, sourceLen) @@ -705,11 +727,13 @@ uLong ZEXPORT deflateBound(strm, sourceLen)
/* conservative upper bound for compressed data */ ~13% overhead plus a small constant */
complen = sourceLen + fixedlen = sourceLen + (sourceLen >> 3) + (sourceLen >> 8) +
((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5; (sourceLen >> 9) + 4;
+ DEFLATE_BOUND_ADJUST_COMPLEN(strm, complen, sourceLen); + DEFLATE_BOUND_ADJUST_COMPLEN(strm, fixedlen, sourceLen);
/* if can't get parameters, return conservative bound plus zlib wrapper */ /* upper bound for stored blocks with length 127 (memLevel == 1) --
~4% overhead plus a small constant */
storelen = sourceLen + (sourceLen >> 5) + (sourceLen >> 7) +
(sourceLen >> 11) + 7;
+ DEFLATE_BOUND_ADJUST_COMPLEN(strm, storelen, sourceLen);
/* if can't get parameters, return larger bound plus a zlib wrapper */
if (deflateStateCheck(strm)) if (deflateStateCheck(strm))
@@ -741,7 +764,8 @@ uLong ZEXPORT deflateBound(strm, sourceLen) @@ -751,7 +775,8 @@ uLong ZEXPORT deflateBound(strm, sourceLen)
} }
/* if not default parameters, return conservative bound */ /* if not default parameters, return one of the conservative bounds */
- if (s->w_bits != 15 || s->hash_bits != 8 + 7) - if (s->w_bits != 15 || s->hash_bits != 8 + 7)
+ if (DEFLATE_NEED_CONSERVATIVE_BOUND(strm) || + if (DEFLATE_NEED_CONSERVATIVE_BOUND(strm) ||
+ s->w_bits != 15 || s->hash_bits != 8 + 7) + s->w_bits != 15 || s->hash_bits != 8 + 7)
return complen + wraplen; return (s->w_bits <= s->hash_bits ? fixedlen : storelen) + wraplen;
/* default settings: return tight bound for that case */ /* default settings: return tight bound for that case -- ~0.03% overhead
@@ -768,7 +792,7 @@ local void putShortMSB (s, b) @@ -779,7 +804,7 @@ local void putShortMSB(s, b)
* applications may wish to modify it to avoid allocating a large * applications may wish to modify it to avoid allocating a large
* strm->next_out buffer and copying into it. (See also read_buf()). * strm->next_out buffer and copying into it. (See also read_buf()).
*/ */
@ -1559,7 +1564,7 @@ index 6ac891d7d..afca18ce2 100644
z_streamp strm; z_streamp strm;
{ {
unsigned len; unsigned len;
@@ -1040,7 +1064,8 @@ int ZEXPORT deflate (strm, flush) @@ -1051,7 +1076,8 @@ int ZEXPORT deflate(strm, flush)
(flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
block_state bstate; block_state bstate;
@ -1569,7 +1574,7 @@ index 6ac891d7d..afca18ce2 100644
s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) : s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) :
s->strategy == Z_RLE ? deflate_rle(s, flush) : s->strategy == Z_RLE ? deflate_rle(s, flush) :
(*(configuration_table[s->level].func))(s, flush); (*(configuration_table[s->level].func))(s, flush);
@@ -1087,7 +1112,6 @@ int ZEXPORT deflate (strm, flush) @@ -1098,7 +1124,6 @@ int ZEXPORT deflate(strm, flush)
} }
if (flush != Z_FINISH) return Z_OK; if (flush != Z_FINISH) return Z_OK;
@ -1577,7 +1582,7 @@ index 6ac891d7d..afca18ce2 100644
/* Write the trailer */ /* Write the trailer */
#ifdef GZIP #ifdef GZIP
@@ -1103,7 +1127,7 @@ int ZEXPORT deflate (strm, flush) @@ -1114,7 +1139,7 @@ int ZEXPORT deflate(strm, flush)
} }
else else
#endif #endif
@ -1586,7 +1591,7 @@ index 6ac891d7d..afca18ce2 100644
putShortMSB(s, (uInt)(strm->adler >> 16)); putShortMSB(s, (uInt)(strm->adler >> 16));
putShortMSB(s, (uInt)(strm->adler & 0xffff)); putShortMSB(s, (uInt)(strm->adler & 0xffff));
} }
@@ -1112,7 +1136,11 @@ int ZEXPORT deflate (strm, flush) @@ -1123,7 +1148,11 @@ int ZEXPORT deflate(strm, flush)
* to flush the rest. * to flush the rest.
*/ */
if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */ if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */
@ -1599,7 +1604,7 @@ index 6ac891d7d..afca18ce2 100644
} }
/* ========================================================================= */ /* ========================================================================= */
@@ -1129,9 +1157,9 @@ int ZEXPORT deflateEnd (strm) @@ -1140,9 +1169,9 @@ int ZEXPORT deflateEnd(strm)
TRY_FREE(strm, strm->state->pending_buf); TRY_FREE(strm, strm->state->pending_buf);
TRY_FREE(strm, strm->state->head); TRY_FREE(strm, strm->state->head);
TRY_FREE(strm, strm->state->prev); TRY_FREE(strm, strm->state->prev);
@ -1611,7 +1616,7 @@ index 6ac891d7d..afca18ce2 100644
strm->state = Z_NULL; strm->state = Z_NULL;
return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
@@ -1161,13 +1189,13 @@ int ZEXPORT deflateCopy (dest, source) @@ -1172,13 +1201,13 @@ int ZEXPORT deflateCopy(dest, source)
zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream)); zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
@ -1628,7 +1633,7 @@ index 6ac891d7d..afca18ce2 100644
ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4); ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4);
@@ -1214,7 +1242,8 @@ local unsigned read_buf(strm, buf, size) @@ -1225,7 +1254,8 @@ local unsigned read_buf(strm, buf, size)
strm->avail_in -= len; strm->avail_in -= len;
zmemcpy(buf, strm->next_in, len); zmemcpy(buf, strm->next_in, len);
@ -1639,7 +1644,7 @@ index 6ac891d7d..afca18ce2 100644
} }
#ifdef GZIP #ifdef GZIP
diff --git a/deflate.h b/deflate.h diff --git a/deflate.h b/deflate.h
index 1a06cd5f2..f92750ca6 100644 index 1a06cd5..f92750c 100644
--- a/deflate.h --- a/deflate.h
+++ b/deflate.h +++ b/deflate.h
@@ -299,6 +299,7 @@ void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s)); @@ -299,6 +299,7 @@ void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s));
@ -1667,7 +1672,7 @@ index 1a06cd5f2..f92750ca6 100644
+ +
#endif /* DEFLATE_H */ #endif /* DEFLATE_H */
diff --git a/gzguts.h b/gzguts.h diff --git a/gzguts.h b/gzguts.h
index 57faf3716..581f2b631 100644 index 57faf37..581f2b6 100644
--- a/gzguts.h --- a/gzguts.h
+++ b/gzguts.h +++ b/gzguts.h
@@ -153,7 +153,11 @@ @@ -153,7 +153,11 @@
@ -1683,7 +1688,7 @@ index 57faf3716..581f2b631 100644
/* gzip modes, also provide a little integrity check on the passed structure */ /* gzip modes, also provide a little integrity check on the passed structure */
#define GZ_NONE 0 #define GZ_NONE 0
diff --git a/inflate.c b/inflate.c diff --git a/inflate.c b/inflate.c
index 7be8c6366..a0e14e292 100644 index 8acbef4..918dfa7 100644
--- a/inflate.c --- a/inflate.c
+++ b/inflate.c +++ b/inflate.c
@@ -85,6 +85,24 @@ @@ -85,6 +85,24 @@
@ -1719,7 +1724,7 @@ index 7be8c6366..a0e14e292 100644
Tracev((stderr, "inflate: reset\n")); Tracev((stderr, "inflate: reset\n"));
return Z_OK; return Z_OK;
} }
@@ -183,7 +202,7 @@ int windowBits; @@ -185,7 +204,7 @@ int windowBits;
if (windowBits && (windowBits < 8 || windowBits > 15)) if (windowBits && (windowBits < 8 || windowBits > 15))
return Z_STREAM_ERROR; return Z_STREAM_ERROR;
if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) { if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
@ -1728,7 +1733,7 @@ index 7be8c6366..a0e14e292 100644
state->window = Z_NULL; state->window = Z_NULL;
} }
@@ -222,7 +241,7 @@ int stream_size; @@ -224,7 +243,7 @@ int stream_size;
strm->zfree = zcfree; strm->zfree = zcfree;
#endif #endif
state = (struct inflate_state FAR *) state = (struct inflate_state FAR *)
@ -1737,7 +1742,7 @@ index 7be8c6366..a0e14e292 100644
if (state == Z_NULL) return Z_MEM_ERROR; if (state == Z_NULL) return Z_MEM_ERROR;
Tracev((stderr, "inflate: allocated\n")); Tracev((stderr, "inflate: allocated\n"));
strm->state = (struct internal_state FAR *)state; strm->state = (struct internal_state FAR *)state;
@@ -231,7 +250,7 @@ int stream_size; @@ -233,7 +252,7 @@ int stream_size;
state->mode = HEAD; /* to pass state test in inflateReset2() */ state->mode = HEAD; /* to pass state test in inflateReset2() */
ret = inflateReset2(strm, windowBits); ret = inflateReset2(strm, windowBits);
if (ret != Z_OK) { if (ret != Z_OK) {
@ -1746,7 +1751,7 @@ index 7be8c6366..a0e14e292 100644
strm->state = Z_NULL; strm->state = Z_NULL;
} }
return ret; return ret;
@@ -253,6 +272,7 @@ int value; @@ -255,6 +274,7 @@ int value;
struct inflate_state FAR *state; struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return Z_STREAM_ERROR; if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
@ -1754,7 +1759,7 @@ index 7be8c6366..a0e14e292 100644
state = (struct inflate_state FAR *)strm->state; state = (struct inflate_state FAR *)strm->state;
if (bits < 0) { if (bits < 0) {
state->hold = 0; state->hold = 0;
@@ -380,6 +400,27 @@ void makefixed() @@ -382,6 +402,27 @@ void makefixed()
} }
#endif /* MAKEFIXED */ #endif /* MAKEFIXED */
@ -1782,7 +1787,7 @@ index 7be8c6366..a0e14e292 100644
/* /*
Update the window with the last wsize (normally 32K) bytes written before Update the window with the last wsize (normally 32K) bytes written before
returning. If window does not exist yet, create it. This is only called returning. If window does not exist yet, create it. This is only called
@@ -404,20 +445,7 @@ unsigned copy; @@ -406,20 +447,7 @@ unsigned copy;
state = (struct inflate_state FAR *)strm->state; state = (struct inflate_state FAR *)strm->state;
@ -1804,7 +1809,7 @@ index 7be8c6366..a0e14e292 100644
/* copy state->wsize or less output bytes into the circular window */ /* copy state->wsize or less output bytes into the circular window */
if (copy >= state->wsize) { if (copy >= state->wsize) {
@@ -860,6 +888,7 @@ int flush; @@ -863,6 +891,7 @@ int flush;
if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave; if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
/* fallthrough */ /* fallthrough */
case TYPEDO: case TYPEDO:
@ -1812,7 +1817,7 @@ index 7be8c6366..a0e14e292 100644
if (state->last) { if (state->last) {
BYTEBITS(); BYTEBITS();
state->mode = CHECK; state->mode = CHECK;
@@ -1221,7 +1250,7 @@ int flush; @@ -1224,7 +1253,7 @@ int flush;
out -= left; out -= left;
strm->total_out += out; strm->total_out += out;
state->total += out; state->total += out;
@ -1821,7 +1826,7 @@ index 7be8c6366..a0e14e292 100644
strm->adler = state->check = strm->adler = state->check =
UPDATE_CHECK(state->check, put - out, out); UPDATE_CHECK(state->check, put - out, out);
out = left; out = left;
@@ -1276,8 +1305,9 @@ int flush; @@ -1279,8 +1308,9 @@ int flush;
*/ */
inf_leave: inf_leave:
RESTORE(); RESTORE();
@ -1833,7 +1838,7 @@ index 7be8c6366..a0e14e292 100644
if (updatewindow(strm, strm->next_out, out - strm->avail_out)) { if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
state->mode = MEM; state->mode = MEM;
return Z_MEM_ERROR; return Z_MEM_ERROR;
@@ -1287,7 +1317,7 @@ int flush; @@ -1290,7 +1320,7 @@ int flush;
strm->total_in += in; strm->total_in += in;
strm->total_out += out; strm->total_out += out;
state->total += out; state->total += out;
@ -1842,7 +1847,7 @@ index 7be8c6366..a0e14e292 100644
strm->adler = state->check = strm->adler = state->check =
UPDATE_CHECK(state->check, strm->next_out - out, out); UPDATE_CHECK(state->check, strm->next_out - out, out);
strm->data_type = (int)state->bits + (state->last ? 64 : 0) + strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
@@ -1305,8 +1335,8 @@ z_streamp strm; @@ -1308,8 +1338,8 @@ z_streamp strm;
if (inflateStateCheck(strm)) if (inflateStateCheck(strm))
return Z_STREAM_ERROR; return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state; state = (struct inflate_state FAR *)strm->state;
@ -1853,7 +1858,7 @@ index 7be8c6366..a0e14e292 100644
strm->state = Z_NULL; strm->state = Z_NULL;
Tracev((stderr, "inflate: end\n")); Tracev((stderr, "inflate: end\n"));
return Z_OK; return Z_OK;
@@ -1485,6 +1515,7 @@ z_streamp strm; @@ -1488,6 +1518,7 @@ z_streamp strm;
struct inflate_state FAR *state; struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return Z_STREAM_ERROR; if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
@ -1861,7 +1866,7 @@ index 7be8c6366..a0e14e292 100644
state = (struct inflate_state FAR *)strm->state; state = (struct inflate_state FAR *)strm->state;
return state->mode == STORED && state->bits == 0; return state->mode == STORED && state->bits == 0;
} }
@@ -1505,21 +1536,22 @@ z_streamp source; @@ -1508,21 +1539,22 @@ z_streamp source;
/* allocate space */ /* allocate space */
copy = (struct inflate_state FAR *) copy = (struct inflate_state FAR *)
@ -1888,7 +1893,7 @@ index 7be8c6366..a0e14e292 100644
copy->strm = dest; copy->strm = dest;
if (state->lencode >= state->codes && if (state->lencode >= state->codes &&
state->lencode <= state->codes + ENOUGH - 1) { state->lencode <= state->codes + ENOUGH - 1) {
@@ -1576,6 +1608,7 @@ z_streamp strm; @@ -1579,6 +1611,7 @@ z_streamp strm;
if (inflateStateCheck(strm)) if (inflateStateCheck(strm))
return -(1L << 16); return -(1L << 16);
@ -1897,7 +1902,7 @@ index 7be8c6366..a0e14e292 100644
return (long)(((unsigned long)((long)state->back)) << 16) + return (long)(((unsigned long)((long)state->back)) << 16) +
(state->mode == COPY ? state->length : (state->mode == COPY ? state->length :
diff --git a/inflate.h b/inflate.h diff --git a/inflate.h b/inflate.h
index f127b6b1f..519ed3535 100644 index f127b6b..519ed35 100644
--- a/inflate.h --- a/inflate.h
+++ b/inflate.h +++ b/inflate.h
@@ -124,3 +124,5 @@ struct inflate_state { @@ -124,3 +124,5 @@ struct inflate_state {
@ -1907,7 +1912,7 @@ index f127b6b1f..519ed3535 100644
+ +
+int ZLIB_INTERNAL inflate_ensure_window OF((struct inflate_state *state)); +int ZLIB_INTERNAL inflate_ensure_window OF((struct inflate_state *state));
diff --git a/test/infcover.c b/test/infcover.c diff --git a/test/infcover.c b/test/infcover.c
index 2be01646c..a208219dc 100644 index 2be0164..a208219 100644
--- a/test/infcover.c --- a/test/infcover.c
+++ b/test/infcover.c +++ b/test/infcover.c
@@ -373,7 +373,7 @@ local void cover_support(void) @@ -373,7 +373,7 @@ local void cover_support(void)
@ -1929,7 +1934,7 @@ index 2be01646c..a208219dc 100644
static unsigned int next = 0; static unsigned int next = 0;
static unsigned char dat[] = {0x63, 0, 2, 0}; static unsigned char dat[] = {0x63, 0, 2, 0};
diff --git a/test/minigzip.c b/test/minigzip.c diff --git a/test/minigzip.c b/test/minigzip.c
index e22fb08c0..4b5f4efed 100644 index a649d2b..964408a 100644
--- a/test/minigzip.c --- a/test/minigzip.c
+++ b/test/minigzip.c +++ b/test/minigzip.c
@@ -132,7 +132,11 @@ static void pwinerror (s) @@ -132,7 +132,11 @@ static void pwinerror (s)
@ -1945,7 +1950,7 @@ index e22fb08c0..4b5f4efed 100644
#ifdef MAXSEG_64K #ifdef MAXSEG_64K
diff --git a/trees.c b/trees.c diff --git a/trees.c b/trees.c
index 8b438cce4..84c1b4732 100644 index 5f305c4..4924bdf 100644
--- a/trees.c --- a/trees.c
+++ b/trees.c +++ b/trees.c
@@ -149,8 +149,6 @@ local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, @@ -149,8 +149,6 @@ local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
@ -1971,7 +1976,7 @@ index 8b438cce4..84c1b4732 100644
/* the arguments must not have side effects */ /* the arguments must not have side effects */
@@ -1134,7 +1139,7 @@ local int detect_data_type(s) @@ -1133,7 +1138,7 @@ local int detect_data_type(s)
* method would use a table) * method would use a table)
* IN assertion: 1 <= len <= 15 * IN assertion: 1 <= len <= 15
*/ */
@ -1980,7 +1985,7 @@ index 8b438cce4..84c1b4732 100644
unsigned code; /* the value to invert */ unsigned code; /* the value to invert */
int len; /* its bit length */ int len; /* its bit length */
{ {
@@ -1166,7 +1171,7 @@ local void bi_flush(s) @@ -1165,7 +1170,7 @@ local void bi_flush(s)
/* =========================================================================== /* ===========================================================================
* Flush the bit buffer and align the output on a byte boundary * Flush the bit buffer and align the output on a byte boundary
*/ */
@ -1990,7 +1995,7 @@ index 8b438cce4..84c1b4732 100644
{ {
if (s->bi_valid > 8) { if (s->bi_valid > 8) {
diff --git a/zutil.h b/zutil.h diff --git a/zutil.h b/zutil.h
index d9a20ae1b..bc83f59d0 100644 index 0bc7f4e..75eb4df 100644
--- a/zutil.h --- a/zutil.h
+++ b/zutil.h +++ b/zutil.h
@@ -87,6 +87,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */ @@ -87,6 +87,8 @@ extern z_const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
@ -2002,3 +2007,6 @@ index d9a20ae1b..bc83f59d0 100644
/* target dependencies */ /* target dependencies */
#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32)) #if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
--
2.37.3

View File

@ -1,11 +1,9 @@
diff --git a/deflate.c b/deflate.c --- zlib-1.2.13/deflate.c.old 2022-11-24 16:41:34.527200490 +0000
index 1ec7614..b724c8d 100644 +++ zlib-1.2.13/deflate.c 2022-11-24 16:43:28.064200490 +0000
--- a/deflate.c @@ -1305,15 +1305,16 @@ local void lm_init(s)
+++ b/deflate.c * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1
@@ -1322,15 +1322,16 @@ local void lm_init (s) * OUT assertion: the match length is not greater than s->lookahead.
#define longest_match longest_match_default */
#endif /* Z_POWER_OPT */
-local uInt longest_match(s, cur_match) -local uInt longest_match(s, cur_match)
+local uInt longest_match(s, pcur_match) +local uInt longest_match(s, pcur_match)
deflate_state *s; deflate_state *s;
@ -22,17 +20,17 @@ index 1ec7614..b724c8d 100644
int nice_match = s->nice_match; /* stop if match long enough */ int nice_match = s->nice_match; /* stop if match long enough */
IPos limit = s->strstart > (IPos)MAX_DIST(s) ? IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
s->strstart - (IPos)MAX_DIST(s) : NIL; s->strstart - (IPos)MAX_DIST(s) : NIL;
@@ -1256,12 +1257,12 @@ local uInt longest_match(s, cur_match) @@ -1328,12 +1329,12 @@ local uInt longest_match(s, cur_match)
* Try with and without -DUNALIGNED_OK to check. * Try with and without -DUNALIGNED_OK to check.
*/ */
register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
- register ush scan_start = *(ushf*)scan; - register ush scan_start = *(ushf*)scan;
- register ush scan_end = *(ushf*)(scan+best_len-1); - register ush scan_end = *(ushf*)(scan + best_len - 1);
+ register uInt scan_start = *(ushf*)scan; + register uInt scan_start = *(ushf*)scan;
+ register uInt scan_end = *(ushf*)(scan+best_len-1); + register uInt scan_end = *(ushf*)(scan+best_len-1);
#else #else
register Bytef *strend = s->window + s->strstart + MAX_MATCH; register Bytef *strend = s->window + s->strstart + MAX_MATCH;
- register Byte scan_end1 = scan[best_len-1]; - register Byte scan_end1 = scan[best_len - 1];
- register Byte scan_end = scan[best_len]; - register Byte scan_end = scan[best_len];
+ register uInt scan_end1 = scan[best_len-1]; + register uInt scan_end1 = scan[best_len-1];
+ register uInt scan_end = scan[best_len]; + register uInt scan_end = scan[best_len];

View File

@ -1,4 +1,4 @@
From 957bc67cfb4e01403c01fe6243850383183a7c19 Mon Sep 17 00:00:00 2001 From 6ae549062cb4b766c5cc726406f8612310cc12b5 Mon Sep 17 00:00:00 2001
From: Ilya Leoshkevich <iii@linux.ibm.com> From: Ilya Leoshkevich <iii@linux.ibm.com>
Date: Thu, 19 Mar 2020 11:52:03 +0100 Date: Thu, 19 Mar 2020 11:52:03 +0100
Subject: [PATCH] s390x: vectorize crc32 Subject: [PATCH] s390x: vectorize crc32
@ -19,18 +19,18 @@ choose between the regular and the vectorized implementations.
create mode 100644 contrib/s390/crc32_z_resolver.c create mode 100644 contrib/s390/crc32_z_resolver.c
diff --git a/Makefile.in b/Makefile.in diff --git a/Makefile.in b/Makefile.in
index 2e78f38..04c2f5d 100644 index a811c10..af62c22 100644
--- a/Makefile.in --- a/Makefile.in
+++ b/Makefile.in +++ b/Makefile.in
@@ -29,6 +29,7 @@ LDFLAGS= @@ -25,6 +25,7 @@ LDFLAGS=
TEST_LDFLAGS=-L. libz.a TEST_LDFLAGS=$(LDFLAGS) -L. libz.a
LDSHARED=$(CC) LDSHARED=$(CC)
CPP=$(CC) -E CPP=$(CC) -E
+VGFMAFLAG= +VGFMAFLAG=
STATICLIB=libz.a STATICLIB=libz.a
SHAREDLIB=libz.so SHAREDLIB=libz.so
@@ -179,6 +180,9 @@ crc32.o: $(SRCDIR)crc32.c @@ -175,6 +176,9 @@ crc32.o: $(SRCDIR)crc32.c
crc32_z_power8.o: $(SRCDIR)contrib/power/crc32_z_power8.c crc32_z_power8.o: $(SRCDIR)contrib/power/crc32_z_power8.c
$(CC) $(CFLAGS) -mcpu=power8 $(ZINC) -c -o $@ $(SRCDIR)contrib/power/crc32_z_power8.c $(CC) $(CFLAGS) -mcpu=power8 $(ZINC) -c -o $@ $(SRCDIR)contrib/power/crc32_z_power8.c
@ -40,7 +40,7 @@ index 2e78f38..04c2f5d 100644
deflate.o: $(SRCDIR)deflate.c deflate.o: $(SRCDIR)deflate.c
$(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c $(CC) $(CFLAGS) $(ZINC) -c -o $@ $(SRCDIR)deflate.c
@@ -229,6 +233,11 @@ crc32.lo: $(SRCDIR)crc32.c @@ -225,6 +229,11 @@ crc32.lo: $(SRCDIR)crc32.c
$(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/crc32.o $(SRCDIR)crc32.c $(CC) $(SFLAGS) $(ZINC) -DPIC -c -o objs/crc32.o $(SRCDIR)crc32.c
-@mv objs/crc32.o $@ -@mv objs/crc32.o $@
@ -53,11 +53,11 @@ index 2e78f38..04c2f5d 100644
-@mkdir objs 2>/dev/null || test -d objs -@mkdir objs 2>/dev/null || test -d objs
$(CC) $(SFLAGS) -mcpu=power8 $(ZINC) -DPIC -c -o objs/crc32_z_power8.o $(SRCDIR)contrib/power/crc32_z_power8.c $(CC) $(SFLAGS) -mcpu=power8 $(ZINC) -DPIC -c -o objs/crc32_z_power8.o $(SRCDIR)contrib/power/crc32_z_power8.c
diff --git a/configure b/configure diff --git a/configure b/configure
index dd01b5c..acf94a5 100755 index ab3204a..04ee943 100755
--- a/configure --- a/configure
+++ b/configure +++ b/configure
@@ -927,6 +927,32 @@ else @@ -921,6 +921,32 @@ else
echo "Checking for sys/sdt.h ... No." | tee -a configure.log echo "Checking for Power optimizations support... No." | tee -a configure.log
fi fi
+# check if we are compiling for s390 and binutils support vector extensions +# check if we are compiling for s390 and binutils support vector extensions
@ -89,7 +89,7 @@ index dd01b5c..acf94a5 100755
# show the results in the log # show the results in the log
echo >> configure.log echo >> configure.log
echo ALL = $ALL >> configure.log echo ALL = $ALL >> configure.log
@@ -960,6 +986,7 @@ echo mandir = $mandir >> configure.log @@ -952,6 +978,7 @@ echo mandir = $mandir >> configure.log
echo prefix = $prefix >> configure.log echo prefix = $prefix >> configure.log
echo sharedlibdir = $sharedlibdir >> configure.log echo sharedlibdir = $sharedlibdir >> configure.log
echo uname = $uname >> configure.log echo uname = $uname >> configure.log
@ -97,7 +97,7 @@ index dd01b5c..acf94a5 100755
# udpate Makefile with the configure results # udpate Makefile with the configure results
sed < ${SRCDIR}Makefile.in " sed < ${SRCDIR}Makefile.in "
@@ -969,6 +996,7 @@ sed < ${SRCDIR}Makefile.in " @@ -961,6 +988,7 @@ sed < ${SRCDIR}Makefile.in "
/^LDFLAGS *=/s#=.*#=$LDFLAGS# /^LDFLAGS *=/s#=.*#=$LDFLAGS#
/^LDSHARED *=/s#=.*#=$LDSHARED# /^LDSHARED *=/s#=.*#=$LDSHARED#
/^CPP *=/s#=.*#=$CPP# /^CPP *=/s#=.*#=$CPP#
@ -388,10 +388,10 @@ index 0000000..9749cab
+ return crc32_z_default; + return crc32_z_default;
+} +}
diff --git a/crc32.c b/crc32.c diff --git a/crc32.c b/crc32.c
index ae7b7e7..c212261 100644 index 4e5830b..0b458ce 100644
--- a/crc32.c --- a/crc32.c
+++ b/crc32.c +++ b/crc32.c
@@ -736,12 +736,12 @@ local z_word_t crc_word_big(data) @@ -745,12 +745,12 @@ local z_word_t crc_word_big(data)
#endif #endif
/* ========================================================================= */ /* ========================================================================= */
@ -406,7 +406,7 @@ index ae7b7e7..c212261 100644
unsigned long ZEXPORT crc32_z(crc, buf, len) unsigned long ZEXPORT crc32_z(crc, buf, len)
unsigned long crc; unsigned long crc;
@@ -1064,10 +1064,15 @@ unsigned long ZEXPORT crc32_z(crc, buf, len) @@ -1073,10 +1073,15 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
return crc ^ 0xffffffff; return crc ^ 0xffffffff;
} }
@ -424,5 +424,5 @@ index ae7b7e7..c212261 100644
#endif #endif
-- --
2.35.1 2.37.3

View File

@ -1,8 +1,8 @@
%bcond_without minizip %bcond_without minizip
Name: zlib Name: zlib
Version: 1.2.12 Version: 1.2.13
Release: 5%{?dist} Release: 1%{?dist}
Summary: Compression and decompression library Summary: Compression and decompression library
# /contrib/dotzlib/ have Boost license # /contrib/dotzlib/ have Boost license
License: zlib and Boost License: zlib and Boost
@ -12,30 +12,21 @@ Source: https://www.zlib.net/zlib-%{version}.tar.xz
# https://github.com/madler/zlib/pull/210 # https://github.com/madler/zlib/pull/210
Patch0: zlib-1.2.5-minizip-fixuncrypt.patch Patch0: zlib-1.2.5-minizip-fixuncrypt.patch
# resolves: #805113 # resolves: #805113
Patch1: zlib-1.2.11-optimized-s390.patch Patch1: zlib-1.2.13-optimized-s390.patch
# IBM optimized crc32 for Power 8+ processors
# ref: https://github.com/madler/zlib/pull/750
Patch18: zlib-1.2.13-power-optimizations.patch
# IBM Z hardware-accelerated deflate # IBM Z hardware-accelerated deflate
# ref: https://github.com/madler/zlib/pull/410 # ref: https://github.com/madler/zlib/pull/410
Patch18: zlib-1.2.12-IBM-Z-hw-accelerated-deflate.patch Patch19: zlib-1.2.13-IBM-Z-hw-accelerated-deflate.patch
# IBM optimized crc32 for Power 8+ processors
# ref: https://github.com/madler/zlib/pull/478
Patch19: zlib-1.2.12-power-optimizations.patch
# Patch for s390x crc32vx # Patch for s390x crc32vx
# ref: https://github.com/iii-i/zlib/releases/tag/crc32vx-v3 # ref: https://github.com/iii-i/zlib/releases/tag/crc32vx-v3
Patch20: zlib-1.2.12-s390x-vectorize-crc32.patch Patch20: zlib-1.2.13-s390x-vectorize-crc32.patch
# Fix for configure
# ref: https://github.com/madler/zlib/pull/607/commits/80d086357a55b94a13e43756cf3e131f25eef0e4
Patch21: zlib-1.2.12-fix-configure.patch
# fixed covscan issues # fixed covscan issues
Patch22: zlib-1.2.11-covscan-issues.patch Patch22: zlib-1.2.11-covscan-issues.patch
# fixed issues found by covscan for rhel-9 # fixed issues found by covscan for rhel-9
# ref: https://github.com/madler/zlib/pull/554 # ref: https://github.com/madler/zlib/pull/554
Patch23: zlib-1.2.11-covscan-issues-rhel9.patch Patch23: zlib-1.2.11-covscan-issues-rhel9.patch
# Correct incorrect inputs provided to the CRC functions.
# ref: https://github.com/madler/zlib/commit/ec3df00224d4b396e2ac6586ab5d25f673caa4c2
Patch24: zlib-1.2.12-correct-inputs-provided-to-crc-func.patch
# Fix for CVE-2022-37434
# ref: https://github.com/madler/zlib/commit/1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d
Patch25: zlib-1.2.12-fix-CVE-2022-37434.patch
BuildRequires: make BuildRequires: make
BuildRequires: automake, autoconf, libtool BuildRequires: automake, autoconf, libtool
@ -94,11 +85,8 @@ developing applications which use minizip.
%patch18 -p1 %patch18 -p1
%patch19 -p1 %patch19 -p1
%patch20 -p1 %patch20 -p1
%patch21 -p1
%patch22 -p1 %patch22 -p1
%patch23 -p1 %patch23 -p1
%patch24 -p1
%patch25 -p1
# Patch19 conflicts with Patch1, so the Patch1 has to be applied after, # Patch19 conflicts with Patch1, so the Patch1 has to be applied after,
# because it is arch specific # because it is arch specific
%ifarch s390 s390x %ifarch s390 s390x
@ -181,6 +169,10 @@ find $RPM_BUILD_ROOT -name '*.la' -delete
%changelog %changelog
* Mon Oct 17 2022 Lukas Javorsky <ljavorsk@redhat.com> - 1.2.13-1
- Rebase to version 1.2.13
- Patches 21,24,25 has been upstreamed
* Tue Aug 09 2022 Lukas Javorsky <ljavorsk@redhat.com> - 1.2.12-5 * Tue Aug 09 2022 Lukas Javorsky <ljavorsk@redhat.com> - 1.2.12-5
- Fix heap-based buffer over-read or buffer overflow in inflate in inflate.c - Fix heap-based buffer over-read or buffer overflow in inflate in inflate.c
- Resolves: CVE-2022-37434 - Resolves: CVE-2022-37434