Auto sync2gitlab import of zlib-1.2.11-17.el8.src.rpm

This commit is contained in:
James Antill 2022-05-26 16:24:50 -04:00
parent 93c7965ac1
commit 8d28f7e121
14 changed files with 5874 additions and 1 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/zlib-1.2.11.tar.xz

1
EMPTY
View File

@ -1 +0,0 @@

1
sources Normal file
View File

@ -0,0 +1 @@
SHA512 (zlib-1.2.11.tar.xz) = b7f50ada138c7f93eb7eb1631efccd1d9f03a5e77b6c13c8b757017b2d462e19d2d3e01c50fad60a4ae1bc86d431f6f94c72c11ff410c25121e571953017cb67

View File

@ -0,0 +1,206 @@
Subject: [PATCH] Fixed DFLTCC compression level switching issues
---
configure | 4 +--
contrib/s390/dfltcc.c | 52 ++++++++++++++++++++++++++++++-----
contrib/s390/dfltcc_deflate.h | 2 ++
deflate.c | 12 ++++----
test/infcover.c | 2 +-
5 files changed, 57 insertions(+), 15 deletions(-)
diff --git a/configure b/configure
index bfe4386..70ed86b 100755
--- a/configure
+++ b/configure
@@ -139,7 +139,7 @@ case "$1" in
-w* | --warn) warn=1; shift ;;
-d* | --debug) debug=1; shift ;;
--dfltcc)
- CFLAGS="$CFLAGS -DDFLTCC"
+ CFLAGS="$CFLAGS -DDFLTCC -DDFLTCC_LEVEL_MASK=0x7e"
OBJC="$OBJC dfltcc.o"
PIC_OBJC="$PIC_OBJC dfltcc.lo"
shift
@@ -838,7 +838,7 @@ cat > $test.c << EOF
#include <sys/sdt.h>
int main() { return 0; }
EOF
-if try ${CC} ${CFLAGS} $test.c; then
+ if try $CC -c $CFLAGS $test.c; then
echo "Checking for sys/sdt.h ... Yes." | tee -a configure.log
CFLAGS="$CFLAGS -DHAVE_SYS_SDT_H"
SFLAGS="$SFLAGS -DHAVE_SYS_SDT_H"
diff --git a/contrib/s390/dfltcc.c b/contrib/s390/dfltcc.c
index d88a0d6..94a196f 100644
--- a/contrib/s390/dfltcc.c
+++ b/contrib/s390/dfltcc.c
@@ -350,8 +350,12 @@ int ZLIB_INTERNAL dfltcc_deflate(strm, flush, result)
int soft_bcc;
int no_flush;
- if (!dfltcc_can_deflate(strm))
+ if (!dfltcc_can_deflate(strm)) {
+ /* Clear history. */
+ if (flush == Z_FULL_FLUSH)
+ param->hl = 0;
return 0;
+ }
again:
masked_avail_in = 0;
@@ -376,7 +380,8 @@ again:
/* Clear history. */
if (flush == Z_FULL_FLUSH)
param->hl = 0;
- *result = need_more;
+ /* Trigger block post-processing if necessary. */
+ *result = no_flush ? need_more : block_done;
return 1;
}
@@ -403,13 +408,18 @@ again:
param->bcf = 0;
dfltcc_state->block_threshold =
strm->total_in + dfltcc_state->block_size;
- if (strm->avail_out == 0) {
- *result = need_more;
- return 1;
- }
}
}
+ /* No space for compressed data. If we proceed, dfltcc_cmpr() will return
+ * DFLTCC_CC_OP1_TOO_SHORT without buffering header bits, but we will still
+ * set BCF=1, which is wrong. Avoid complications and return early.
+ */
+ if (strm->avail_out == 0) {
+ *result = need_more;
+ return 1;
+ }
+
/* The caller gave us too much data. Pass only one block worth of
* uncompressed data to DFLTCC and mask the rest, so that on the next
* iteration we start a new block.
@@ -737,10 +747,15 @@ __attribute__((constructor)) local void init_globals(void)
* compiling with -m31, gcc defaults to ESA mode, however, since the kernel
* is 64-bit, it's always z/Architecture mode at runtime.
*/
- __asm__ volatile(".machinemode push\n"
+ __asm__ volatile(
+#ifndef __clang__
+ ".machinemode push\n"
".machinemode zarch\n"
+#endif
"stfle %[facilities]\n"
+#ifndef __clang__
".machinemode pop\n"
+#endif
: [facilities] "=Q" (cpu_facilities)
, [r0] "+r" (r0)
:
@@ -872,6 +887,28 @@ int ZLIB_INTERNAL dfltcc_deflate_params(strm, level, strategy, flush)
return Z_OK;
}
+int ZLIB_INTERNAL dfltcc_deflate_done(strm, flush)
+ z_streamp strm;
+ int flush;
+{
+ deflate_state FAR *state = (deflate_state FAR *)strm->state;
+ struct dfltcc_state FAR *dfltcc_state = GET_DFLTCC_STATE(state);
+ struct dfltcc_param_v0 FAR *param = &dfltcc_state->param;
+
+ /* When deflate(Z_FULL_FLUSH) is called with small avail_out, it might
+ * close the block without resetting the compression state. Detect this
+ * situation and return that deflation is not done.
+ */
+ if (flush == Z_FULL_FLUSH && strm->avail_out == 0)
+ return 0;
+
+ /* Return that deflation is not done if DFLTCC is used and either it
+ * buffered some data (Continuation Flag is set), or has not written EOBS
+ * yet (Block-Continuation Flag is set).
+ */
+ return !dfltcc_can_deflate(strm) || (!param->cf && !param->bcf);
+}
+
/*
Preloading history.
*/
@@ -925,6 +962,7 @@ int ZLIB_INTERNAL dfltcc_deflate_set_dictionary(strm, dictionary, dict_length)
append_history(param, state->window, dictionary, dict_length);
state->strstart = 1; /* Add FDICT to zlib header */
+ state->block_start = state->strstart; /* Make deflate_stored happy */
return Z_OK;
}
diff --git a/contrib/s390/dfltcc_deflate.h b/contrib/s390/dfltcc_deflate.h
index de36784..914daa4 100644
--- a/contrib/s390/dfltcc_deflate.h
+++ b/contrib/s390/dfltcc_deflate.h
@@ -11,6 +11,7 @@ int ZLIB_INTERNAL dfltcc_deflate_params OF((z_streamp strm,
int level,
int strategy,
int *flush));
+int ZLIB_INTERNAL dfltcc_deflate_done OF((z_streamp strm, int flush));
int ZLIB_INTERNAL dfltcc_deflate_set_dictionary OF((z_streamp strm,
const Bytef *dictionary,
uInt dict_length));
@@ -41,6 +42,7 @@ int ZLIB_INTERNAL dfltcc_deflate_get_dictionary OF((z_streamp strm,
if (err == Z_STREAM_ERROR) \
return err; \
} while (0)
+#define DEFLATE_DONE dfltcc_deflate_done
#define DEFLATE_BOUND_ADJUST_COMPLEN(strm, complen, source_len) \
do { \
if (dfltcc_can_deflate((strm))) \
diff --git a/deflate.c b/deflate.c
index d907a1b..085abbe 100644
--- a/deflate.c
+++ b/deflate.c
@@ -75,6 +75,7 @@ const char deflate_copyright[] =
#define DEFLATE_GET_DICTIONARY_HOOK(strm, dict, dict_len) do {} while (0)
#define DEFLATE_RESET_KEEP_HOOK(strm) do {} while (0)
#define DEFLATE_PARAMS_HOOK(strm, level, strategy, hook_flush) do {} while (0)
+#define DEFLATE_DONE(strm, flush) 1
#define DEFLATE_BOUND_ADJUST_COMPLEN(strm, complen, sourceLen) do {} while (0)
#define DEFLATE_NEED_CONSERVATIVE_BOUND(strm) 0
#define DEFLATE_HOOK(strm, flush, bstate) 0
@@ -605,14 +606,15 @@ int ZEXPORT deflateParams(strm, level, strategy)
DEFLATE_PARAMS_HOOK(strm, level, strategy, &hook_flush);
func = configuration_table[s->level].func;
- if ((strategy != s->strategy || func != configuration_table[level].func ||
- hook_flush != Z_NO_FLUSH) && s->last_flush != -2) {
+ if (((strategy != s->strategy || func != configuration_table[level].func) &&
+ s->last_flush != -2) || hook_flush != Z_NO_FLUSH) {
/* Flush the last buffer: */
- int err = deflate(strm, RANK(hook_flush) > RANK(Z_BLOCK) ?
- hook_flush : Z_BLOCK);
+ int flush = RANK(hook_flush) > RANK(Z_BLOCK) ? hook_flush : Z_BLOCK;
+ int err = deflate(strm, flush);
if (err == Z_STREAM_ERROR)
return err;
- if (strm->avail_in || (s->strstart - s->block_start) + s->lookahead)
+ if (strm->avail_in || (s->strstart - s->block_start) + s->lookahead ||
+ !DEFLATE_DONE(strm, flush))
return Z_BUF_ERROR;
}
if (s->level != level) {
diff --git a/test/infcover.c b/test/infcover.c
index a34cd17..a208219 100644
--- a/test/infcover.c
+++ b/test/infcover.c
@@ -373,7 +373,7 @@ local void cover_support(void)
mem_setup(&strm);
strm.avail_in = 0;
strm.next_in = Z_NULL;
- ret = inflateInit_(&strm, ZLIB_VERSION - 1, (int)sizeof(z_stream));
+ ret = inflateInit_(&strm, &ZLIB_VERSION[1], (int)sizeof(z_stream));
assert(ret == Z_VERSION_ERROR);
mem_done(&strm, "wrong version");
--
2.26.0

View File

@ -0,0 +1,516 @@
From 608b71008c16ce6fbf2305145c5ffb69cd88ef59 Mon Sep 17 00:00:00 2001
From: Ondrej Dubaj <odubaj@redhat.com>
Date: Fri, 7 Aug 2020 07:12:50 +0200
Subject: [PATCH] Fix for Z hardware-accelerated deflate for s390x
---
configure | 7 +
contrib/s390/dfltcc.c | 244 +++++++++++++++++++++-------------
contrib/s390/dfltcc_deflate.h | 10 +-
deflate.c | 21 +--
4 files changed, 177 insertions(+), 105 deletions(-)
diff --git a/configure b/configure
index 66caece..bfe4386 100755
--- a/configure
+++ b/configure
@@ -114,6 +114,7 @@ case "$1" in
echo ' configure [--const] [--zprefix] [--prefix=PREFIX] [--eprefix=EXPREFIX]' | 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 ' [--dfltcc]' | tee -a configure.log
exit 0 ;;
-p*=* | --prefix=*) prefix=`echo $1 | sed 's/.*=//'`; shift ;;
-e*=* | --eprefix=*) exec_prefix=`echo $1 | sed 's/.*=//'`; shift ;;
@@ -137,6 +138,12 @@ case "$1" in
-c* | --const) zconst=1; shift ;;
-w* | --warn) warn=1; shift ;;
-d* | --debug) debug=1; shift ;;
+ --dfltcc)
+ CFLAGS="$CFLAGS -DDFLTCC"
+ OBJC="$OBJC dfltcc.o"
+ PIC_OBJC="$PIC_OBJC dfltcc.lo"
+ shift
+ ;;
*)
echo "unknown option: $1" | tee -a configure.log
echo "$0 --help for help" | tee -a configure.log
diff --git a/contrib/s390/dfltcc.c b/contrib/s390/dfltcc.c
index d187796..d88a0d6 100644
--- a/contrib/s390/dfltcc.c
+++ b/contrib/s390/dfltcc.c
@@ -2,12 +2,13 @@
/*
Use the following commands to build zlib with DFLTCC support:
- $ CFLAGS=-DDFLTCC ./configure
- $ make OBJA=dfltcc.o PIC_OBJA=dfltcc.lo
+ $ ./configure --dfltcc
+ $ make
*/
#define _GNU_SOURCE
#include <ctype.h>
+#include <errno.h>
#include <inttypes.h>
#include <stddef.h>
#include <stdio.h>
@@ -230,31 +231,28 @@ struct dfltcc_state {
/*
Compress.
*/
-local inline int dfltcc_are_params_ok(int level,
- uInt window_bits,
- int strategy,
- uLong level_mask);
-local inline int dfltcc_are_params_ok(level, window_bits, strategy, level_mask)
+local inline int dfltcc_can_deflate_with_params(z_streamp strm,
+ int level,
+ uInt window_bits,
+ int strategy);
+local inline int dfltcc_can_deflate_with_params(strm,
+ level,
+ window_bits,
+ strategy)
+ z_streamp strm;
int level;
uInt window_bits;
int strategy;
- uLong level_mask;
-{
- return (level_mask & (1 << level)) != 0 &&
- (window_bits == HB_BITS) &&
- (strategy == Z_FIXED || strategy == Z_DEFAULT_STRATEGY);
-}
-
-
-int ZLIB_INTERNAL dfltcc_can_deflate(strm)
- z_streamp strm;
{
deflate_state FAR *state = (deflate_state FAR *)strm->state;
struct dfltcc_state FAR *dfltcc_state = GET_DFLTCC_STATE(state);
/* Unsupported compression settings */
- if (!dfltcc_are_params_ok(state->level, state->w_bits, state->strategy,
- dfltcc_state->level_mask))
+ if ((dfltcc_state->level_mask & (1 << level)) == 0)
+ return 0;
+ if (window_bits != HB_BITS)
+ return 0;
+ if (strategy != Z_FIXED && strategy != Z_DEFAULT_STRATEGY)
return 0;
/* Unsupported hardware */
@@ -266,6 +264,17 @@ int ZLIB_INTERNAL dfltcc_can_deflate(strm)
return 1;
}
+int ZLIB_INTERNAL dfltcc_can_deflate(strm)
+ z_streamp strm;
+{
+ deflate_state FAR *state = (deflate_state FAR *)strm->state;
+
+ return dfltcc_can_deflate_with_params(strm,
+ state->level,
+ state->w_bits,
+ state->strategy);
+}
+
local void dfltcc_gdht OF((z_streamp strm));
local void dfltcc_gdht(strm)
z_streamp strm;
@@ -349,22 +358,24 @@ again:
soft_bcc = 0;
no_flush = flush == Z_NO_FLUSH;
- /* Trailing empty block. Switch to software, except when Continuation Flag
- * is set, which means that DFLTCC has buffered some output in the
- * parameter block and needs to be called again in order to flush it.
+ /* No input data. Return, except when Continuation Flag is set, which means
+ * that DFLTCC has buffered some output in the parameter block and needs to
+ * be called again in order to flush it.
*/
- if (flush == Z_FINISH && strm->avail_in == 0 && !param->cf) {
- if (param->bcf) {
- /* A block is still open, and the hardware does not support closing
- * blocks without adding data. Thus, close it manually.
- */
+ if (strm->avail_in == 0 && !param->cf) {
+ /* A block is still open, and the hardware does not support closing
+ * blocks without adding data. Thus, close it manually.
+ */
+ if (!no_flush && param->bcf) {
send_eobs(strm, param);
param->bcf = 0;
}
- return 0;
- }
-
- if (strm->avail_in == 0 && !param->cf) {
+ /* Let one of deflate_* functions write a trailing empty block. */
+ if (flush == Z_FINISH)
+ return 0;
+ /* Clear history. */
+ if (flush == Z_FULL_FLUSH)
+ param->hl = 0;
*result = need_more;
return 1;
}
@@ -418,7 +429,7 @@ again:
param->cvt = state->wrap == 2 ? CVT_CRC32 : CVT_ADLER32;
if (!no_flush)
/* We need to close a block. Always do this in software - when there is
- * no input data, the hardware will not nohor BCC. */
+ * no input data, the hardware will not honor BCC. */
soft_bcc = 1;
if (flush == Z_FINISH && !param->bcf)
/* We are about to open a BFINAL block, set Block Header Final bit
@@ -433,8 +444,8 @@ again:
param->sbb = (unsigned int)state->bi_valid;
if (param->sbb > 0)
*strm->next_out = (Bytef)state->bi_buf;
- if (param->hl)
- param->nt = 0; /* Honor history */
+ /* Honor history and check value */
+ param->nt = 0;
param->cv = state->wrap == 2 ? ZSWAP32(strm->adler) : strm->adler;
/* When opening a block, choose a Huffman-Table Type */
@@ -642,27 +653,86 @@ int ZLIB_INTERNAL dfltcc_inflate_disable(strm)
return 0;
}
-/*
- Memory management.
- DFLTCC requires parameter blocks and window to be aligned. zlib allows
- users to specify their own allocation functions, so using e.g.
- `posix_memalign' is not an option. Thus, we overallocate and take the
- aligned portion of the buffer.
-*/
+local int env_dfltcc_disabled;
+local int env_source_date_epoch;
+local unsigned long env_level_mask;
+local unsigned long env_block_size;
+local unsigned long env_block_threshold;
+local unsigned long env_dht_threshold;
+local unsigned long env_ribm;
+local uint64_t cpu_facilities[(DFLTCC_FACILITY / 64) + 1];
+local struct dfltcc_qaf_param cpu_af __attribute__((aligned(8)));
+
local inline int is_dfltcc_enabled OF((void));
local inline int is_dfltcc_enabled(void)
+{
+ if (env_dfltcc_disabled)
+ /* User has explicitly disabled DFLTCC. */
+ return 0;
+
+ return is_bit_set((const char *)cpu_facilities, DFLTCC_FACILITY);
+}
+
+local unsigned long xstrtoul OF((const char *s, unsigned long _default));
+local unsigned long xstrtoul(s, _default)
+ const char *s;
+ unsigned long _default;
+{
+ char *endptr;
+ unsigned long result;
+
+ if (!(s && *s))
+ return _default;
+ errno = 0;
+ result = strtoul(s, &endptr, 0);
+ return (errno || *endptr) ? _default : result;
+}
+
+__attribute__((constructor)) local void init_globals OF((void));
+__attribute__((constructor)) local void init_globals(void)
{
const char *env;
- uint64_t facilities[(DFLTCC_FACILITY / 64) + 1];
register char r0 __asm__("r0");
env = secure_getenv("DFLTCC");
- if (env && !strcmp(env, "0"))
- /* User has explicitly disabled DFLTCC. */
- return 0;
+
+
+ env_dfltcc_disabled = env && !strcmp(env, "0");
+
+ env = secure_getenv("SOURCE_DATE_EPOCH");
+ env_source_date_epoch = !!env;
+
+#ifndef DFLTCC_LEVEL_MASK
+#define DFLTCC_LEVEL_MASK 0x2
+#endif
+ env_level_mask = xstrtoul(secure_getenv("DFLTCC_LEVEL_MASK"),
+ DFLTCC_LEVEL_MASK);
+
+#ifndef DFLTCC_BLOCK_SIZE
+#define DFLTCC_BLOCK_SIZE 1048576
+#endif
+ env_block_size = xstrtoul(secure_getenv("DFLTCC_BLOCK_SIZE"),
+ DFLTCC_BLOCK_SIZE);
- memset(facilities, 0, sizeof(facilities));
- r0 = sizeof(facilities) / sizeof(facilities[0]) - 1;
+#ifndef DFLTCC_FIRST_FHT_BLOCK_SIZE
+#define DFLTCC_FIRST_FHT_BLOCK_SIZE 4096
+#endif
+ env_block_threshold = xstrtoul(secure_getenv("DFLTCC_FIRST_FHT_BLOCK_SIZE"),
+ DFLTCC_FIRST_FHT_BLOCK_SIZE);
+
+#ifndef DFLTCC_DHT_MIN_SAMPLE_SIZE
+#define DFLTCC_DHT_MIN_SAMPLE_SIZE 4096
+#endif
+ env_dht_threshold = xstrtoul(secure_getenv("DFLTCC_DHT_MIN_SAMPLE_SIZE"),
+ DFLTCC_DHT_MIN_SAMPLE_SIZE);
+
+#ifndef DFLTCC_RIBM
+#define DFLTCC_RIBM 0
+#endif
+ env_ribm = xstrtoul(secure_getenv("DFLTCC_RIBM"), DFLTCC_RIBM);
+
+ memset(cpu_facilities, 0, sizeof(cpu_facilities));
+ r0 = sizeof(cpu_facilities) / sizeof(cpu_facilities[0]) - 1;
/* STFLE is supported since z9-109 and only in z/Architecture mode. When
* compiling with -m31, gcc defaults to ESA mode, however, since the kernel
* is 64-bit, it's always z/Architecture mode at runtime.
@@ -671,31 +741,35 @@ local inline int is_dfltcc_enabled(void)
".machinemode zarch\n"
"stfle %[facilities]\n"
".machinemode pop\n"
- : [facilities] "=Q" (facilities)
+ : [facilities] "=Q" (cpu_facilities)
, [r0] "+r" (r0)
:
: "cc");
- return is_bit_set((const char *)facilities, DFLTCC_FACILITY);
+ /* Initialize available functions */
+ if (is_dfltcc_enabled())
+ dfltcc(DFLTCC_QAF, &cpu_af, NULL, NULL, NULL, NULL, NULL);
+ else
+ memset(&cpu_af, 0, sizeof(cpu_af));
}
+/*
+ Memory management.
+
+ DFLTCC requires parameter blocks and window to be aligned. zlib allows
+ users to specify their own allocation functions, so using e.g.
+ `posix_memalign' is not an option. Thus, we overallocate and take the
+ aligned portion of the buffer.
+*/
void ZLIB_INTERNAL dfltcc_reset(strm, size)
z_streamp strm;
uInt size;
{
struct dfltcc_state *dfltcc_state =
(struct dfltcc_state *)((char FAR *)strm->state + ALIGN_UP(size, 8));
- struct dfltcc_qaf_param *param =
- (struct dfltcc_qaf_param *)&dfltcc_state->param;
- const char *s;
- /* Initialize available functions */
- if (is_dfltcc_enabled()) {
- dfltcc(DFLTCC_QAF, param, NULL, NULL, NULL, NULL, NULL);
- memmove(&dfltcc_state->af, param, sizeof(dfltcc_state->af));
- } else
- memset(&dfltcc_state->af, 0, sizeof(dfltcc_state->af));
+ memcpy(&dfltcc_state->af, &cpu_af, sizeof(dfltcc_state->af));
- if (secure_getenv("SOURCE_DATE_EPOCH"))
+ if (env_source_date_epoch)
/* User needs reproducible results, but the output of DFLTCC_CMPR
* depends on buffers' page offsets.
*/
@@ -706,36 +780,11 @@ void ZLIB_INTERNAL dfltcc_reset(strm, size)
dfltcc_state->param.nt = 1;
/* Initialize tuning parameters */
-#ifndef DFLTCC_LEVEL_MASK
-#define DFLTCC_LEVEL_MASK 0x2
-#endif
- s = secure_getenv("DFLTCC_LEVEL_MASK");
- dfltcc_state->level_mask = (s && *s) ? strtoul(s, NULL, 0) :
- DFLTCC_LEVEL_MASK;
-#ifndef DFLTCC_BLOCK_SIZE
-#define DFLTCC_BLOCK_SIZE 1048576
-#endif
- s = secure_getenv("DFLTCC_BLOCK_SIZE");
- dfltcc_state->block_size = (s && *s) ? strtoul(s, NULL, 0) :
- DFLTCC_BLOCK_SIZE;
-#ifndef DFLTCC_FIRST_FHT_BLOCK_SIZE
-#define DFLTCC_FIRST_FHT_BLOCK_SIZE 4096
-#endif
- s = secure_getenv("DFLTCC_FIRST_FHT_BLOCK_SIZE");
- dfltcc_state->block_threshold = (s && *s) ? strtoul(s, NULL, 0) :
- DFLTCC_FIRST_FHT_BLOCK_SIZE;
-#ifndef DFLTCC_DHT_MIN_SAMPLE_SIZE
-#define DFLTCC_DHT_MIN_SAMPLE_SIZE 4096
-#endif
- s = secure_getenv("DFLTCC_DHT_MIN_SAMPLE_SIZE");
- dfltcc_state->dht_threshold = (s && *s) ? strtoul(s, NULL, 0) :
- DFLTCC_DHT_MIN_SAMPLE_SIZE;
-#ifndef DFLTCC_RIBM
-#define DFLTCC_RIBM 0
-#endif
- s = secure_getenv("DFLTCC_RIBM");
- dfltcc_state->param.ribm = (s && *s) ? strtoul(s, NULL, 0) :
- DFLTCC_RIBM;
+ dfltcc_state->level_mask = env_level_mask;
+ dfltcc_state->block_size = env_block_size;
+ dfltcc_state->block_threshold = env_block_threshold;
+ dfltcc_state->dht_threshold = env_dht_threshold;
+ dfltcc_state->param.ribm = env_ribm;
}
voidpf ZLIB_INTERNAL dfltcc_alloc_state(strm, items, size)
@@ -787,22 +836,26 @@ void ZLIB_INTERNAL dfltcc_free_window(strm, w)
/*
Switching between hardware and software compression.
+
DFLTCC does not support all zlib settings, e.g. generation of non-compressed
blocks or alternative window sizes. When such settings are applied on the
fly with deflateParams, we need to convert between hardware and software
window formats.
*/
-int ZLIB_INTERNAL dfltcc_deflate_params(strm, level, strategy)
+int ZLIB_INTERNAL dfltcc_deflate_params(strm, level, strategy, flush)
z_streamp strm;
int level;
int strategy;
+ int *flush;
{
deflate_state FAR *state = (deflate_state FAR *)strm->state;
struct dfltcc_state FAR *dfltcc_state = GET_DFLTCC_STATE(state);
struct dfltcc_param_v0 FAR *param = &dfltcc_state->param;
int could_deflate = dfltcc_can_deflate(strm);
- int can_deflate = dfltcc_are_params_ok(level, state->w_bits, strategy,
- dfltcc_state->level_mask);
+ int can_deflate = dfltcc_can_deflate_with_params(strm,
+ level,
+ state->w_bits,
+ strategy);
if (can_deflate == could_deflate)
/* We continue to work in the same mode - no changes needed */
@@ -812,8 +865,11 @@ int ZLIB_INTERNAL dfltcc_deflate_params(strm, level, strategy)
/* DFLTCC was not used yet - no changes needed */
return Z_OK;
- /* Switching between hardware and software is not implemented */
- return Z_STREAM_ERROR;
+ /* For now, do not convert between window formats - simply get rid of the
+ * old data instead.
+ */
+ *flush = Z_FULL_FLUSH;
+ return Z_OK;
}
/*
diff --git a/contrib/s390/dfltcc_deflate.h b/contrib/s390/dfltcc_deflate.h
index a129a91..de36784 100644
--- a/contrib/s390/dfltcc_deflate.h
+++ b/contrib/s390/dfltcc_deflate.h
@@ -9,7 +9,8 @@ int ZLIB_INTERNAL dfltcc_deflate OF((z_streamp strm,
block_state *result));
int ZLIB_INTERNAL dfltcc_deflate_params OF((z_streamp strm,
int level,
- int strategy));
+ int strategy,
+ int *flush));
int ZLIB_INTERNAL dfltcc_deflate_set_dictionary OF((z_streamp strm,
const Bytef *dictionary,
uInt dict_length));
@@ -29,11 +30,14 @@ int ZLIB_INTERNAL dfltcc_deflate_get_dictionary OF((z_streamp strm,
} while (0)
#define DEFLATE_RESET_KEEP_HOOK(strm) \
dfltcc_reset((strm), sizeof(deflate_state))
-#define DEFLATE_PARAMS_HOOK(strm, level, strategy) \
+#define DEFLATE_PARAMS_HOOK(strm, level, strategy, hook_flush) \
do { \
int err; \
\
- err = dfltcc_deflate_params((strm), (level), (strategy)); \
+ err = dfltcc_deflate_params((strm), \
+ (level), \
+ (strategy), \
+ (hook_flush)); \
if (err == Z_STREAM_ERROR) \
return err; \
} while (0)
diff --git a/deflate.c b/deflate.c
index b17a7dd..a80bd3e 100644
--- a/deflate.c
+++ b/deflate.c
@@ -74,7 +74,7 @@ const char deflate_copyright[] =
#define DEFLATE_SET_DICTIONARY_HOOK(strm, dict, dict_len) do {} while (0)
#define DEFLATE_GET_DICTIONARY_HOOK(strm, dict, dict_len) do {} while (0)
#define DEFLATE_RESET_KEEP_HOOK(strm) do {} while (0)
-#define DEFLATE_PARAMS_HOOK(strm, level, strategy) do {} while (0)
+#define DEFLATE_PARAMS_HOOK(strm, level, strategy, hook_flush) do {} while (0)
#define DEFLATE_BOUND_ADJUST_COMPLEN(strm, complen, sourceLen) do {} while (0)
#define DEFLATE_NEED_CONSERVATIVE_BOUND(strm) 0
#define DEFLATE_HOOK(strm, flush, bstate) 0
@@ -589,6 +589,7 @@ int ZEXPORT deflateParams(strm, level, strategy)
{
deflate_state *s;
compress_func func;
+ int hook_flush = Z_NO_FLUSH;
if (deflateStateCheck(strm)) return Z_STREAM_ERROR;
s = strm->state;
@@ -601,13 +602,14 @@ int ZEXPORT deflateParams(strm, level, strategy)
if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {
return Z_STREAM_ERROR;
}
- DEFLATE_PARAMS_HOOK(strm, level, strategy);
+ DEFLATE_PARAMS_HOOK(strm, level, strategy, &hook_flush);
func = configuration_table[s->level].func;
- if ((strategy != s->strategy || func != configuration_table[level].func) &&
- s->high_water) {
+ if ((strategy != s->strategy || func != configuration_table[level].func ||
+ hook_flush != Z_NO_FLUSH) && s->high_water) {
/* Flush the last buffer: */
- int err = deflate(strm, Z_BLOCK);
+ int err = deflate(strm, RANK(hook_flush) > RANK(Z_BLOCK) ?
+ hook_flush : Z_BLOCK);
if (err == Z_STREAM_ERROR)
return err;
if (strm->avail_out == 0)
@@ -1065,7 +1067,6 @@ int ZEXPORT deflate (strm, flush)
}
if (flush != Z_FINISH) return Z_OK;
- if (s->wrap <= 0) return Z_STREAM_END;
/* Write the trailer */
#ifdef GZIP
@@ -1081,7 +1082,7 @@ int ZEXPORT deflate (strm, flush)
}
else
#endif
- {
+ if (s->wrap == 1) {
putShortMSB(s, (uInt)(strm->adler >> 16));
putShortMSB(s, (uInt)(strm->adler & 0xffff));
}
@@ -1090,7 +1091,11 @@ int ZEXPORT deflate (strm, flush)
* to flush the rest.
*/
if (s->wrap > 0) s->wrap = -s->wrap; /* write the trailer only once! */
- return s->pending != 0 ? Z_OK : Z_STREAM_END;
+ if (s->pending == 0) {
+ Assert(s->bi_valid == 0, "bi_buf not flushed");
+ return Z_STREAM_END;
+ }
+ return Z_OK;
}
/* ========================================================================= */
--
2.26.0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,74 @@
From f776e1609cc63bf486634ee9bc6226dac2c0d2f3 Mon Sep 17 00:00:00 2001
From: Ondrej Dubaj <odubaj@redhat.com>
Date: Tue, 15 Oct 2019 11:27:15 +0200
Subject: [PATCH] fixed covscan issues
---
crc32.c | 2 +-
deflate.c | 2 +-
test/crc32_test.c | 8 ++++----
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/crc32.c b/crc32.c
index 406d350..34132ea 100644
--- a/crc32.c
+++ b/crc32.c
@@ -302,7 +302,7 @@ unsigned long ZEXPORT crc32_z(crc, buf, len)
if (!crc32_func)
crc32_func = crc32_z_ifunc();
- return (*crc32_func)(crc, buf, len);
+ return (*crc32_func)(crc, buf, len);
}
#endif /* defined(Z_IFUNC_ASM) || defined(Z_IFUNC_NATIVE) */
diff --git a/deflate.c b/deflate.c
index 089285a..9b09718 100644
--- a/deflate.c
+++ b/deflate.c
@@ -1015,7 +1015,7 @@ int ZEXPORT deflate (strm, flush)
*/
if (strm->avail_in != 0 || s->lookahead != 0 ||
(flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
- block_state bstate;
+ block_state bstate = 0;
bstate = DEFLATE_HOOK(strm, flush, &bstate) ? bstate :
s->level == 0 ? deflate_stored(s, flush) :
diff --git a/test/crc32_test.c b/test/crc32_test.c
index 5d73128..2d2a6c7 100644
--- a/test/crc32_test.c
+++ b/test/crc32_test.c
@@ -11,25 +11,25 @@
# include <stdlib.h>
#endif
-void test_crc32 OF((uLong crc, Byte* buf, z_size_t len, uLong chk, int line));
+void test_crc32 OF((uLong crc, char* buf, z_size_t len, uLong chk, int line));
int main OF((void));
typedef struct {
int line;
uLong crc;
- Byte* buf;
+ char* buf;
int len;
uLong expect;
} crc32_test;
void test_crc32(crc, buf, len, chk, line)
uLong crc;
- Byte *buf;
+ char *buf;
z_size_t len;
uLong chk;
int line;
{
- uLong res = crc32(crc, buf, len);
+ uLong res = crc32(crc, (Bytef *) buf, len);
if (res != chk) {
fprintf(stderr, "FAIL [%d]: crc32 returned 0x%08X expected 0x%08X\n",
line, (unsigned int)res, (unsigned int)chk);
--
2.19.1

View File

@ -0,0 +1,365 @@
From 27a84de4a30cd35f8565937397f6d1205b912818 Mon Sep 17 00:00:00 2001
From: Ondrej Dubaj <odubaj@redhat.com>
Date: Thu, 5 Sep 2019 09:16:35 +0200
Subject: [PATCH 1/2] fix: power8 crc32 - return 0 with 0 ptr passed
---
contrib/power8-crc/vec_crc32.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/contrib/power8-crc/vec_crc32.c b/contrib/power8-crc/vec_crc32.c
index bb2204b..5ce9cd2 100644
--- a/contrib/power8-crc/vec_crc32.c
+++ b/contrib/power8-crc/vec_crc32.c
@@ -74,6 +74,7 @@ unsigned int CRC32_FUNCTION(unsigned int crc, const unsigned char *p,
unsigned int prealign;
unsigned int tail;
+ if (p == (const unsigned char *) 0x0) return 0;
#ifdef CRC_XOR
crc ^= 0xffffffff;
#endif
--
2.19.1
From c066ac92982a2ffe5b1e9bd36000058927437bd5 Mon Sep 17 00:00:00 2001
From: Ondrej Dubaj <odubaj@redhat.com>
Date: Thu, 5 Sep 2019 09:36:47 +0200
Subject: [PATCH 2/2] Add CRC32 tests (crc32_test)
This commit includes a CRC32 test (crc32_test). This tests are important
since some architectures may want include CPU dependent optimizations for
CRC32 algorithm like using vector instructions and we may want to
validate those.
---
Makefile.in | 35 +++++---
test/crc32_test.c | 205 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 230 insertions(+), 10 deletions(-)
create mode 100644 test/crc32_test.c
diff --git a/Makefile.in b/Makefile.in
index 40b5cfb..6070dcc 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -75,11 +75,11 @@ PIC_OBJS = $(PIC_OBJC) $(PIC_OBJA)
all: static shared
-static: example$(EXE) minigzip$(EXE)
+static: crc32_test$(EXE) example$(EXE) minigzip$(EXE)
-shared: examplesh$(EXE) minigzipsh$(EXE)
+shared: crc32_testsh$(EXE) examplesh$(EXE) minigzipsh$(EXE)
-all64: example64$(EXE) minigzip64$(EXE)
+all64: crc32_test64$(EXE) example64$(EXE) minigzip64$(EXE)
check: test
@@ -87,7 +87,7 @@ test: all teststatic testshared
teststatic: static
@TMPST=tmpst_$$; \
- if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST ; then \
+ if echo hello world | ./minigzip | ./minigzip -d && ./example $$TMPST && ./crc32_test; then \
echo ' *** zlib test OK ***'; \
else \
echo ' *** zlib test FAILED ***'; false; \
@@ -100,7 +100,7 @@ testshared: shared
DYLD_LIBRARY_PATH=`pwd`:$(DYLD_LIBRARY_PATH) ; export DYLD_LIBRARY_PATH; \
SHLIB_PATH=`pwd`:$(SHLIB_PATH) ; export SHLIB_PATH; \
TMPSH=tmpsh_$$; \
- if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH; then \
+ if echo hello world | ./minigzipsh | ./minigzipsh -d && ./examplesh $$TMPSH && ./crc32_testsh; then \
echo ' *** zlib shared test OK ***'; \
else \
echo ' *** zlib shared test FAILED ***'; false; \
@@ -109,7 +109,7 @@ testshared: shared
test64: all64
@TMP64=tmp64_$$; \
- if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64; then \
+ if echo hello world | ./minigzip64 | ./minigzip64 -d && ./example64 $$TMP64 && ./crc32_test64; then \
echo ' *** zlib 64-bit test OK ***'; \
else \
echo ' *** zlib 64-bit test FAILED ***'; false; \
@@ -157,6 +157,12 @@ example.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
minigzip.o: $(SRCDIR)test/minigzip.c $(SRCDIR)zlib.h zconf.h
$(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/minigzip.c
+crc32_test.o: $(SRCDIR)test/crc32_test.c $(SRCDIR)zlib.h zconf.h
+ $(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/crc32_test.c
+
+crc32_test64.o: $(SRCDIR)test/crc32_test.c $(SRCDIR)zlib.h zconf.h
+ $(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/crc32_test.c
+
example64.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
$(CC) $(CFLAGS) $(ZINCOUT) -D_FILE_OFFSET_BITS=64 -c -o $@ $(SRCDIR)test/example.c
@@ -307,12 +313,21 @@ example$(EXE): example.o $(STATICLIB)
minigzip$(EXE): minigzip.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ minigzip.o $(TEST_LDFLAGS)
+crc32_test$(EXE): crc32_test.o $(STATICLIB)
+ $(CC) $(CFLAGS) -o $@ crc32_test.o $(TEST_LDFLAGS)
+
+crc32_testsh$(EXE): crc32_test.o $(SHAREDLIBV)
+ $(CC) $(CFLAGS) -o $@ crc32_test.o -L. $(SHAREDLIBV)
+
examplesh$(EXE): example.o $(SHAREDLIBV)
$(CC) $(CFLAGS) -o $@ example.o -L. $(SHAREDLIBV)
minigzipsh$(EXE): minigzip.o $(SHAREDLIBV)
$(CC) $(CFLAGS) -o $@ minigzip.o -L. $(SHAREDLIBV)
+crc32_test64$(EXE): crc32_test64.o $(STATICLIB)
+ $(CC) $(CFLAGS) -o $@ crc32_test64.o $(TEST_LDFLAGS)
+
example64$(EXE): example64.o $(STATICLIB)
$(CC) $(CFLAGS) -o $@ example64.o $(TEST_LDFLAGS)
@@ -382,8 +397,8 @@ zconf: $(SRCDIR)zconf.h.in
mostlyclean: clean
clean:
rm -f *.o *.lo *~ \
- example$(EXE) minigzip$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
- example64$(EXE) minigzip64$(EXE) \
+ crc32_test$(EXE) example$(EXE) minigzip$(EXE) crc32_testsh$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
+ crc32_test64$(EXE) example64$(EXE) minigzip64$(EXE) \
infcover \
libz.* foo.gz so_locations \
_match.s maketree contrib/infback9/*.o
@@ -407,7 +422,7 @@ tags:
adler32.o zutil.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
gzclose.o gzlib.o gzread.o gzwrite.o: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
-compress.o example.o minigzip.o uncompr.o: $(SRCDIR)zlib.h zconf.h
+compress.o crc32_test.o example.o minigzip.o uncompr.o: $(SRCDIR)zlib.h zconf.h
crc32.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
deflate.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
infback.o inflate.o: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
@@ -417,7 +432,7 @@ trees.o: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)tr
adler32.lo zutil.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
gzclose.lo gzlib.lo gzread.lo gzwrite.lo: $(SRCDIR)zlib.h zconf.h $(SRCDIR)gzguts.h
-compress.lo example.lo minigzip.lo uncompr.lo: $(SRCDIR)zlib.h zconf.h
+compress.lo crc32_test.lo example.lo minigzip.lo uncompr.lo: $(SRCDIR)zlib.h zconf.h
crc32.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)crc32.h
deflate.lo: $(SRCDIR)deflate.h $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h
infback.lo inflate.lo: $(SRCDIR)zutil.h $(SRCDIR)zlib.h zconf.h $(SRCDIR)inftrees.h $(SRCDIR)inflate.h $(SRCDIR)inffast.h $(SRCDIR)inffixed.h
diff --git a/test/crc32_test.c b/test/crc32_test.c
new file mode 100644
index 0000000..5d73128
--- /dev/null
+++ b/test/crc32_test.c
@@ -0,0 +1,205 @@
+/* crc32_tes.c -- unit test for crc32 in the zlib compression library
+ * Copyright (C) 1995-2006, 2010, 2011, 2016, 2019 Rogerio Alves
+ * For conditions of distribution and use, see copyright notice in zlib.h
+ */
+
+#include "zlib.h"
+#include <stdio.h>
+
+#ifdef STDC
+# include <string.h>
+# include <stdlib.h>
+#endif
+
+void test_crc32 OF((uLong crc, Byte* buf, z_size_t len, uLong chk, int line));
+int main OF((void));
+
+typedef struct {
+ int line;
+ uLong crc;
+ Byte* buf;
+ int len;
+ uLong expect;
+} crc32_test;
+
+void test_crc32(crc, buf, len, chk, line)
+ uLong crc;
+ Byte *buf;
+ z_size_t len;
+ uLong chk;
+ int line;
+{
+ uLong res = crc32(crc, buf, len);
+ if (res != chk) {
+ fprintf(stderr, "FAIL [%d]: crc32 returned 0x%08X expected 0x%08X\n",
+ line, (unsigned int)res, (unsigned int)chk);
+ exit(1);
+ }
+}
+
+static const crc32_test tests[] = {
+ {__LINE__, 0x0, 0x0, 0, 0x0},
+ {__LINE__, 0xffffffff, 0x0, 0, 0x0},
+ {__LINE__, 0x0, 0x0, 255, 0x0}, /* BZ 174799. */
+ {__LINE__, 0x0, 0x0, 256, 0x0},
+ {__LINE__, 0x0, 0x0, 257, 0x0},
+ {__LINE__, 0x0, 0x0, 32767, 0x0},
+ {__LINE__, 0x0, 0x0, 32768, 0x0},
+ {__LINE__, 0x0, 0x0, 32769, 0x0},
+ {__LINE__, 0x0, "", 0, 0x0},
+ {__LINE__, 0xffffffff, "", 0, 0xffffffff},
+ {__LINE__, 0x0, "abacus", 6, 0xc3d7115b},
+ {__LINE__, 0x0, "backlog", 7, 0x269205},
+ {__LINE__, 0x0, "campfire", 8, 0x22a515f8},
+ {__LINE__, 0x0, "delta", 5, 0x9643fed9},
+ {__LINE__, 0x0, "executable", 10, 0xd68eda01},
+ {__LINE__, 0x0, "file", 4, 0x8c9f3610},
+ {__LINE__, 0x0, "greatest", 8, 0xc1abd6cd},
+ {__LINE__, 0x0, "hello", 5, 0x3610a686},
+ {__LINE__, 0x0, "inverter", 8, 0xc9e962c9},
+ {__LINE__, 0x0, "jigsaw", 6, 0xce4e3f69},
+ {__LINE__, 0x0, "karate", 6, 0x890be0e2},
+ {__LINE__, 0x0, "landscape", 9, 0xc4e0330b},
+ {__LINE__, 0x0, "machine", 7, 0x1505df84},
+ {__LINE__, 0x0, "nanometer", 9, 0xd4e19f39},
+ {__LINE__, 0x0, "oblivion", 8, 0xdae9de77},
+ {__LINE__, 0x0, "panama", 6, 0x66b8979c},
+ {__LINE__, 0x0, "quest", 5, 0x4317f817},
+ {__LINE__, 0x0, "resource", 8, 0xbc91f416},
+ {__LINE__, 0x0, "secret", 6, 0x5ca2e8e5},
+ {__LINE__, 0x0, "test", 4, 0xd87f7e0c},
+ {__LINE__, 0x0, "ultimate", 8, 0x3fc79b0b},
+ {__LINE__, 0x0, "vector", 6, 0x1b6e485b},
+ {__LINE__, 0x0, "walrus", 6, 0xbe769b97},
+ {__LINE__, 0x0, "xeno", 4, 0xe7a06444},
+ {__LINE__, 0x0, "yelling", 7, 0xfe3944e5},
+ {__LINE__, 0x0, "zlib", 4, 0x73887d3a},
+ {__LINE__, 0x0, "4BJD7PocN1VqX0jXVpWB", 20, 0xd487a5a1},
+ {__LINE__, 0x0, "F1rPWI7XvDs6nAIRx41l", 20, 0x61a0132e},
+ {__LINE__, 0x0, "ldhKlsVkPFOveXgkGtC2", 20, 0xdf02f76},
+ {__LINE__, 0x0, "5KKnGOOrs8BvJ35iKTOS", 20, 0x579b2b0a},
+ {__LINE__, 0x0, "0l1tw7GOcem06Ddu7yn4", 20, 0xf7d16e2d},
+ {__LINE__, 0x0, "MCr47CjPIn9R1IvE1Tm5", 20, 0x731788f5},
+ {__LINE__, 0x0, "UcixbzPKTIv0SvILHVdO", 20, 0x7112bb11},
+ {__LINE__, 0x0, "dGnAyAhRQDsWw0ESou24", 20, 0xf32a0dac},
+ {__LINE__, 0x0, "di0nvmY9UYMYDh0r45XT", 20, 0x625437bb},
+ {__LINE__, 0x0, "2XKDwHfAhFsV0RhbqtvH", 20, 0x896930f9},
+ {__LINE__, 0x0, "ZhrANFIiIvRnqClIVyeD", 20, 0x8579a37},
+ {__LINE__, 0x0, "v7Q9ehzioTOVeDIZioT1", 20, 0x632aa8e0},
+ {__LINE__, 0x0, "Yod5hEeKcYqyhfXbhxj2", 20, 0xc829af29},
+ {__LINE__, 0x0, "GehSWY2ay4uUKhehXYb0", 20, 0x1b08b7e8},
+ {__LINE__, 0x0, "kwytJmq6UqpflV8Y8GoE", 20, 0x4e33b192},
+ {__LINE__, 0x0, "70684206568419061514", 20, 0x59a179f0},
+ {__LINE__, 0x0, "42015093765128581010", 20, 0xcd1013d7},
+ {__LINE__, 0x0, "88214814356148806939", 20, 0xab927546},
+ {__LINE__, 0x0, "43472694284527343838", 20, 0x11f3b20c},
+ {__LINE__, 0x0, "49769333513942933689", 20, 0xd562d4ca},
+ {__LINE__, 0x0, "54979784887993251199", 20, 0x233395f7},
+ {__LINE__, 0x0, "58360544869206793220", 20, 0x2d167fd5},
+ {__LINE__, 0x0, "27347953487840714234", 20, 0x8b5108ba},
+ {__LINE__, 0x0, "07650690295365319082", 20, 0xc46b3cd8},
+ {__LINE__, 0x0, "42655507906821911703", 20, 0xc10b2662},
+ {__LINE__, 0x0, "29977409200786225655", 20, 0xc9a0f9d2},
+ {__LINE__, 0x0, "85181542907229116674", 20, 0x9341357b},
+ {__LINE__, 0x0, "87963594337989416799", 20, 0xf0424937},
+ {__LINE__, 0x0, "21395988329504168551", 20, 0xd7c4c31f},
+ {__LINE__, 0x0, "51991013580943379423", 20, 0xf11edcc4},
+ {__LINE__, 0x0, "*]+@!);({_$;}[_},?{?;(_?,=-][@", 30, 0x40795df4},
+ {__LINE__, 0x0, "_@:_).&(#.[:[{[:)$++-($_;@[)}+", 30, 0xdd61a631},
+ {__LINE__, 0x0, "&[!,[$_==}+.]@!;*(+},[;:)$;)-@", 30, 0xca907a99},
+ {__LINE__, 0x0, "]{.[.+?+[[=;[?}_#&;[=)__$$:+=_", 30, 0xf652deac},
+ {__LINE__, 0x0, "-%.)=/[@].:.(:,()$;=%@-$?]{%+%", 30, 0xaf39a5a9},
+ {__LINE__, 0x0, "+]#$(@&.=:,*];/.!]%/{:){:@(;)$", 30, 0x6bebb4cf},
+ {__LINE__, 0x0, ")-._.:?[&:.=+}(*$/=!.${;(=$@!}", 30, 0x76430bac},
+ {__LINE__, 0x0, ":(_*&%/[[}+,?#$&*+#[([*-/#;%(]", 30, 0x6c80c388},
+ {__LINE__, 0x0, "{[#-;:$/{)(+[}#]/{&!%(@)%:@-$:", 30, 0xd54d977d},
+ {__LINE__, 0x0, "_{$*,}(&,@.)):=!/%(&(,,-?$}}}!", 30, 0xe3966ad5},
+ {__LINE__, 0x0, "e$98KNzqaV)Y:2X?]77].{gKRD4G5{mHZk,Z)SpU%L3FSgv!Wb8MLAFdi{+fp)c,@8m6v)yXg@]HBDFk?.4&}g5_udE*JHCiH=aL", 100, 0xe7c71db9},
+ {__LINE__, 0x0, "r*Fd}ef+5RJQ;+W=4jTR9)R*p!B;]Ed7tkrLi;88U7g@3v!5pk2X6D)vt,.@N8c]@yyEcKi[vwUu@.Ppm@C6%Mv*3Nw}Y,58_aH)", 100, 0xeaa52777},
+ {__LINE__, 0x0, "h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&", 100, 0xcd472048},
+ {__LINE__, 0x7a30360d, "abacus", 6, 0xf8655a84},
+ {__LINE__, 0x6fd767ee, "backlog", 7, 0x1ed834b1},
+ {__LINE__, 0xefeb7589, "campfire", 8, 0x686cfca},
+ {__LINE__, 0x61cf7e6b, "delta", 5, 0x1554e4b1},
+ {__LINE__, 0xdc712e2, "executable", 10, 0x761b4254},
+ {__LINE__, 0xad23c7fd, "file", 4, 0x7abdd09b},
+ {__LINE__, 0x85cb2317, "greatest", 8, 0x4ba91c6b},
+ {__LINE__, 0x9eed31b0, "inverter", 8, 0xd5e78ba5},
+ {__LINE__, 0xb94f34ca, "jigsaw", 6, 0x23649109},
+ {__LINE__, 0xab058a2, "karate", 6, 0xc5591f41},
+ {__LINE__, 0x5bff2b7a, "landscape", 9, 0xf10eb644},
+ {__LINE__, 0x605c9a5f, "machine", 7, 0xbaa0a636},
+ {__LINE__, 0x51bdeea5, "nanometer", 9, 0x6af89afb},
+ {__LINE__, 0x85c21c79, "oblivion", 8, 0xecae222b},
+ {__LINE__, 0x97216f56, "panama", 6, 0x47dffac4},
+ {__LINE__, 0x18444af2, "quest", 5, 0x70c2fe36},
+ {__LINE__, 0xbe6ce359, "resource", 8, 0x1471d925},
+ {__LINE__, 0x843071f1, "secret", 6, 0x50c9a0db},
+ {__LINE__, 0xf2480c60, "ultimate", 8, 0xf973daf8},
+ {__LINE__, 0x2d2feb3d, "vector", 6, 0x344ac03d},
+ {__LINE__, 0x7490310a, "walrus", 6, 0x6d1408ef},
+ {__LINE__, 0x97d247d4, "xeno", 4, 0xe62670b5},
+ {__LINE__, 0x93cf7599, "yelling", 7, 0x1b36da38},
+ {__LINE__, 0x73c84278, "zlib", 4, 0x6432d127},
+ {__LINE__, 0x228a87d1, "4BJD7PocN1VqX0jXVpWB", 20, 0x997107d0},
+ {__LINE__, 0xa7a048d0, "F1rPWI7XvDs6nAIRx41l", 20, 0xdc567274},
+ {__LINE__, 0x1f0ded40, "ldhKlsVkPFOveXgkGtC2", 20, 0xdcc63870},
+ {__LINE__, 0xa804a62f, "5KKnGOOrs8BvJ35iKTOS", 20, 0x6926cffd},
+ {__LINE__, 0x508fae6a, "0l1tw7GOcem06Ddu7yn4", 20, 0xb52b38bc},
+ {__LINE__, 0xe5adaf4f, "MCr47CjPIn9R1IvE1Tm5", 20, 0xf83b8178},
+ {__LINE__, 0x67136a40, "UcixbzPKTIv0SvILHVdO", 20, 0xc5213070},
+ {__LINE__, 0xb00c4a10, "dGnAyAhRQDsWw0ESou24", 20, 0xbc7648b0},
+ {__LINE__, 0x2e0c84b5, "di0nvmY9UYMYDh0r45XT", 20, 0xd8123a72},
+ {__LINE__, 0x81238d44, "2XKDwHfAhFsV0RhbqtvH", 20, 0xd5ac5620},
+ {__LINE__, 0xf853aa92, "ZhrANFIiIvRnqClIVyeD", 20, 0xceae099d},
+ {__LINE__, 0x5a692325, "v7Q9ehzioTOVeDIZioT1", 20, 0xb07d2b24},
+ {__LINE__, 0x3275b9f, "Yod5hEeKcYqyhfXbhxj2", 20, 0x24ce91df},
+ {__LINE__, 0x38371feb, "GehSWY2ay4uUKhehXYb0", 20, 0x707b3b30},
+ {__LINE__, 0xafc8bf62, "kwytJmq6UqpflV8Y8GoE", 20, 0x16abc6a9},
+ {__LINE__, 0x9b07db73, "70684206568419061514", 20, 0xae1fb7b7},
+ {__LINE__, 0xe75b214, "42015093765128581010", 20, 0xd4eecd2d},
+ {__LINE__, 0x72d0fe6f, "88214814356148806939", 20, 0x4660ec7},
+ {__LINE__, 0xf857a4b1, "43472694284527343838", 20, 0xfd8afdf7},
+ {__LINE__, 0x54b8e14, "49769333513942933689", 20, 0xc6d1b5f2},
+ {__LINE__, 0xd6aa5616, "54979784887993251199", 20, 0x32476461},
+ {__LINE__, 0x11e63098, "58360544869206793220", 20, 0xd917cf1a},
+ {__LINE__, 0xbe92385, "27347953487840714234", 20, 0x4ad14a12},
+ {__LINE__, 0x49511de0, "07650690295365319082", 20, 0xe37b5c6c},
+ {__LINE__, 0x3db13bc1, "42655507906821911703", 20, 0x7cc497f1},
+ {__LINE__, 0xbb899bea, "29977409200786225655", 20, 0x99781bb2},
+ {__LINE__, 0xf6cd9436, "85181542907229116674", 20, 0x132256a1},
+ {__LINE__, 0x9109e6c3, "87963594337989416799", 20, 0xbfdb2c83},
+ {__LINE__, 0x75770fc, "21395988329504168551", 20, 0x8d9d1e81},
+ {__LINE__, 0x69b1d19b, "51991013580943379423", 20, 0x7b6d4404},
+ {__LINE__, 0xc6132975, "*]+@!);({_$;}[_},?{?;(_?,=-][@", 30, 0x8619f010},
+ {__LINE__, 0xd58cb00c, "_@:_).&(#.[:[{[:)$++-($_;@[)}+", 30, 0x15746ac3},
+ {__LINE__, 0xb63b8caa, "&[!,[$_==}+.]@!;*(+},[;:)$;)-@", 30, 0xaccf812f},
+ {__LINE__, 0x8a45a2b8, "]{.[.+?+[[=;[?}_#&;[=)__$$:+=_", 30, 0x78af45de},
+ {__LINE__, 0xcbe95b78, "-%.)=/[@].:.(:,()$;=%@-$?]{%+%", 30, 0x25b06b59},
+ {__LINE__, 0x4ef8a54b, "+]#$(@&.=:,*];/.!]%/{:){:@(;)$", 30, 0x4ba0d08f},
+ {__LINE__, 0x76ad267a, ")-._.:?[&:.=+}(*$/=!.${;(=$@!}", 30, 0xe26b6aac},
+ {__LINE__, 0x569e613c, ":(_*&%/[[}+,?#$&*+#[([*-/#;%(]", 30, 0x7e2b0a66},
+ {__LINE__, 0x36aa61da, "{[#-;:$/{)(+[}#]/{&!%(@)%:@-$:", 30, 0xb3430dc7},
+ {__LINE__, 0xf67222df, "_{$*,}(&,@.)):=!/%(&(,,-?$}}}!", 30, 0x626c17a},
+ {__LINE__, 0x74b34fd3, "e$98KNzqaV)Y:2X?]77].{gKRD4G5{mHZk,Z)SpU%L3FSgv!Wb8MLAFdi{+fp)c,@8m6v)yXg@]HBDFk?.4&}g5_udE*JHCiH=aL", 100, 0xccf98060},
+ {__LINE__, 0x351fd770, "r*Fd}ef+5RJQ;+W=4jTR9)R*p!B;]Ed7tkrLi;88U7g@3v!5pk2X6D)vt,.@N8c]@yyEcKi[vwUu@.Ppm@C6%Mv*3Nw}Y,58_aH)", 100, 0xd8b95312},
+ {__LINE__, 0xc45aef77, "h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&", 100, 0xbb1c9912},
+ {__LINE__, 0xc45aef77, "h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&"
+ "h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&"
+ "h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&"
+ "h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&"
+ "h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&"
+ "h{bcmdC+a;t+Cf{6Y_dFq-{X4Yu&7uNfVDh?q&_u.UWJU],-GiH7ADzb7-V.Q%4=+v!$L9W+T=bP]$_:]Vyg}A.ygD.r;h-D]m%&", 600, 0x888AFA5B}
+};
+
+static const int test_size = sizeof(tests) / sizeof(tests[0]);
+
+int main(void)
+{
+ int i;
+ for (i = 0; i < test_size; i++) {
+ test_crc32(tests[i].crc, tests[i].buf, tests[i].len,
+ tests[i].expect, tests[i].line);
+ }
+ return 0;
+}
\ No newline at end of file
--
2.19.1

View File

@ -0,0 +1,45 @@
Subject: [PATCH] Fixed inflateSyncPoint() bad return value on z15
---
contrib/s390/dfltcc.h | 4 ++++
inflate.c | 2 ++
2 files changed, 6 insertions(+)
diff --git a/contrib/s390/dfltcc.h b/contrib/s390/dfltcc.h
index 574e84c..7960626 100644
--- a/contrib/s390/dfltcc.h
+++ b/contrib/s390/dfltcc.h
@@ -51,5 +51,9 @@ int ZLIB_INTERNAL dfltcc_inflate_disable OF((z_streamp strm));
do { \
if (dfltcc_was_inflate_used((strm))) return -(1L << 16); \
} while (0)
+#define INFLATE_SYNC_POINT_HOOK(strm) \
+ do { \
+ if (dfltcc_was_inflate_used((strm))) return Z_STREAM_ERROR; \
+ } while (0)
#endif
\ No newline at end of file
diff --git a/inflate.c b/inflate.c
index f77c2ae..596034c 100644
--- a/inflate.c
+++ b/inflate.c
@@ -100,6 +100,7 @@
#define INFLATE_NEED_CHECKSUM(strm) 1
#define INFLATE_NEED_UPDATEWINDOW(strm) 1
#define INFLATE_MARK_HOOK(strm) do {} while (0)
+#define INFLATE_SYNC_POINT_HOOK(strm) do {} while (0)
#endif
#ifdef MAKEFIXED
@@ -1483,6 +1484,7 @@ z_streamp strm;
struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
+ INFLATE_SYNC_POINT_HOOK(strm);
state = (struct inflate_state FAR *)strm->state;
return state->mode == STORED && state->bits == 0;
}
--
2.26.0

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,41 @@
diff --git a/deflate.c b/deflate.c
index 1ec7614..b724c8d 100644
--- a/deflate.c
+++ b/deflate.c
@@ -1233,15 +1233,16 @@ local void lm_init (s)
/* For 80x86 and 680x0, an optimized version will be provided in match.asm or
* match.S. The code will be functionally equivalent.
*/
-local uInt longest_match(s, cur_match)
+local uInt longest_match(s, pcur_match)
deflate_state *s;
- IPos cur_match; /* current match */
+ IPos pcur_match; /* current match */
{
+ ptrdiff_t cur_match = pcur_match; /* extend to pointer width */
unsigned chain_length = s->max_chain_length;/* max hash chain length */
register Bytef *scan = s->window + s->strstart; /* current string */
register Bytef *match; /* matched string */
register int len; /* length of current match */
- int best_len = (int)s->prev_length; /* best match length so far */
+ ptrdiff_t best_len = s->prev_length; /* best match length so far */
int nice_match = s->nice_match; /* stop if match long enough */
IPos limit = s->strstart > (IPos)MAX_DIST(s) ?
s->strstart - (IPos)MAX_DIST(s) : NIL;
@@ -1256,12 +1257,12 @@ local uInt longest_match(s, cur_match)
* Try with and without -DUNALIGNED_OK to check.
*/
register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1;
- register ush scan_start = *(ushf*)scan;
- register ush scan_end = *(ushf*)(scan+best_len-1);
+ register uInt scan_start = *(ushf*)scan;
+ register uInt scan_end = *(ushf*)(scan+best_len-1);
#else
register Bytef *strend = s->window + s->strstart + MAX_MATCH;
- register Byte scan_end1 = scan[best_len-1];
- register Byte scan_end = scan[best_len];
+ register uInt scan_end1 = scan[best_len-1];
+ register uInt scan_end = scan[best_len];
#endif
/* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16.

View File

@ -0,0 +1,70 @@
From d09bb1ab8ef9bb91457c0ead09589e8807489260 Mon Sep 17 00:00:00 2001
From: Ondrej Dubaj <odubaj@redhat.com>
Date: Thu, 6 Aug 2020 08:09:53 +0200
Subject: [PATCH] Permit a deflateParams() parameter change.
This change allows a parameter change even if the input data has
not all been compressed and copied to the application output
buffer, so long as all of the input data has been compressed to
the internal pending output buffer. This also allows an immediate
deflateParams change so long as there have been no deflate calls
since initialization or reset.
---
deflate.c | 6 +++---
zlib.h | 11 ++++++-----
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/deflate.c b/deflate.c
index 9705c1c..f3c9924 100644
--- a/deflate.c
+++ b/deflate.c
@@ -509,7 +509,7 @@ int ZEXPORT deflateResetKeep (strm)
s->wrap == 2 ? crc32(0L, Z_NULL, 0) :
#endif
adler32(0L, Z_NULL, 0);
- s->last_flush = Z_NO_FLUSH;
+ s->last_flush = -2;
_tr_init(s);
@@ -606,13 +606,13 @@ int ZEXPORT deflateParams(strm, level, strategy)
func = configuration_table[s->level].func;
if ((strategy != s->strategy || func != configuration_table[level].func ||
- hook_flush != Z_NO_FLUSH) && s->high_water) {
+ hook_flush != Z_NO_FLUSH) && s->last_flush != -2) {
/* Flush the last buffer: */
int err = deflate(strm, RANK(hook_flush) > RANK(Z_BLOCK) ?
hook_flush : Z_BLOCK);
if (err == Z_STREAM_ERROR)
return err;
- if (strm->avail_out == 0)
+ if (strm->avail_in || (s->strstart - s->block_start) + s->lookahead)
return Z_BUF_ERROR;
}
if (s->level != level) {
diff --git a/zlib.h b/zlib.h
index f09cdaf..001624e 100644
--- a/zlib.h
+++ b/zlib.h
@@ -712,11 +712,12 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
used to switch between compression and straight copy of the input data, or
to switch to a different kind of input data requiring a different strategy.
If the compression approach (which is a function of the level) or the
- strategy is changed, and if any input has been consumed in a previous
- deflate() call, then the input available so far is compressed with the old
- level and strategy using deflate(strm, Z_BLOCK). There are three approaches
- for the compression levels 0, 1..3, and 4..9 respectively. The new level
- and strategy will take effect at the next call of deflate().
+ strategy is changed, and if there have been any deflate() calls since the
+ state was initialized or reset, then the input available so far is
+ compressed with the old level and strategy using deflate(strm, Z_BLOCK).
+ There are three approaches for the compression levels 0, 1..3, and 4..9
+ respectively. The new level and strategy will take effect at the next call
+ of deflate().
If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does
not have enough output space to complete, then the parameter change will not
--
2.26.0

View File

@ -0,0 +1,14 @@
diff -up zlib-1.2.5/contrib/minizip/unzip.c.fixuncrypt zlib-1.2.5/contrib/minizip/unzip.c
--- zlib-1.2.5/contrib/minizip/unzip.c.fixuncrypt 2011-11-11 12:13:56.335867758 -0500
+++ zlib-1.2.5/contrib/minizip/unzip.c 2011-11-11 12:14:01.747799372 -0500
@@ -68,10 +68,6 @@
#include <stdlib.h>
#include <string.h>
-#ifndef NOUNCRYPT
- #define NOUNCRYPT
-#endif
-
#include "zlib.h"
#include "unzip.h"

574
zlib.spec Normal file
View File

@ -0,0 +1,574 @@
# disabled, per rhbz#1609830 and rhbz#1602742
%bcond_with minizip
Name: zlib
Version: 1.2.11
Release: 17%{?dist}
Summary: The compression and decompression library
# /contrib/dotzlib/ have Boost license
License: zlib and Boost
URL: http://www.zlib.net/
Source: http://www.zlib.net/zlib-%{version}.tar.xz
# https://github.com/madler/zlib/pull/210
Patch0: zlib-1.2.5-minizip-fixuncrypt.patch
# resolves: #805113
Patch1: zlib-1.2.11-optimized-s390.patch
# IBM Z optimalizations
Patch2: zlib-1.2.11-IBM-Z-hw-accelrated-deflate-s390x.patch
# IBM CRC32 optimalization for POWER archs
Patch3: zlib-1.2.11-optimized-CRC32-framework.patch
# fixed firefox crash + added test case
Patch4: zlib-1.2.11-firefox-crash-fix.patch
# fixed covscan issues
Patch5: zlib-1.2.11-covscan-issues.patch
# fix for IBM Z optimalizations
Patch6: zlib-1.2.11-IBM-Z-hw-accelrated-deflate-fix.patch
# permit a deflateParams() parameter change
Patch7: zlib-1.2.11-permit-deflateParams-change.patch
# fixed DFLTCC compression level switching issues
# enabled HW compression for compression levels 1 through 6
Patch8: zlib-1.2.11-IBM-DFLTCC-compression-level-switching-issues.patch
# fixed inflateSyncPoint() bad return value on z15
Patch9: zlib-1.2.11-inflateSyncPoint-return-value-fix.patch
BuildRequires: automake, autoconf, libtool
%description
Zlib is a general-purpose, patent-free, lossless data compression
library which is used by many different programs.
%package devel
Summary: Header files and libraries for Zlib development
Requires: %{name}%{?_isa} = %{version}-%{release}
%description devel
The zlib-devel package contains the header files and libraries needed
to develop programs that use the zlib compression and decompression
library.
%package static
Summary: Static libraries for Zlib development
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
%description static
The zlib-static package includes static libraries needed
to develop programs that use the zlib compression and
decompression library.
%if %{with minizip}
%package -n minizip
Summary: Library for manipulation with .zip archives
Requires: %{name}%{?_isa} = %{version}-%{release}
%description -n minizip
Minizip is a library for manipulation with files from .zip archives.
%package -n minizip-devel
Summary: Development files for the minizip library
Requires: minizip%{?_isa} = %{version}-%{release}
Requires: %{name}-devel%{?_isa} = %{version}-%{release}
%description -n minizip-devel
This package contains the libraries and header files needed for
developing applications which use minizip.
%endif
%prep
%setup -q
%patch0 -p1 -b .fixuncrypt
%ifarch s390 s390x
%patch1 -p1 -b .optimized-deflate
%endif
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
iconv -f iso-8859-2 -t utf-8 < ChangeLog > ChangeLog.tmp
mv ChangeLog.tmp ChangeLog
%build
export CFLAGS="$RPM_OPT_FLAGS"
%ifarch ppc64
CFLAGS+=" -O3"
%endif
export LDFLAGS="$LDFLAGS -Wl,-z,relro -Wl,-z,now"
# no-autotools, %%configure is not compatible
%ifarch s390 s390x
./configure --libdir=%{_libdir} --includedir=%{_includedir} --prefix=%{_prefix} --dfltcc
%else
./configure --libdir=%{_libdir} --includedir=%{_includedir} --prefix=%{_prefix}
%endif
%make_build
%if %{with minizip}
cd contrib/minizip
autoreconf --install
%configure --enable-static=no
%make_build
%endif
%check
make test
%install
%make_install
%if %{with minizip}
%make_install -C contrib/minizip
# https://github.com/madler/zlib/pull/229
rm $RPM_BUILD_ROOT%_includedir/minizip/crypt.h
%endif
find $RPM_BUILD_ROOT -name '*.la' -delete
%files
%license README
%doc ChangeLog FAQ
%{_libdir}/libz.so.*
%files devel
%doc doc/algorithm.txt test/example.c
%{_libdir}/libz.so
%{_libdir}/pkgconfig/zlib.pc
%{_includedir}/zlib.h
%{_includedir}/zconf.h
%{_mandir}/man3/zlib.3*
%files static
%license README
%{_libdir}/libz.a
%if %{with minizip}
%files -n minizip
%doc contrib/minizip/MiniZip64_info.txt contrib/minizip/MiniZip64_Changes.txt
%{_libdir}/libminizip.so.*
%files -n minizip-devel
%dir %{_includedir}/minizip
%{_includedir}/minizip/*.h
%{_libdir}/libminizip.so
%{_libdir}/pkgconfig/minizip.pc
%endif
%changelog
* Mon Jun 15 2020 Ondrej Dubaj <odubaj@redhat.com> - 1.2.11-17
- Fixed DFLTCC compression level switching issues (#1875492)
- Enabled HW compression for compression levels 1 through 6 (#1847438)
- Fixed inflateSyncPoint() bad return value on z15 (#1888930)
* Mon Jun 15 2020 Ondrej Dubaj <odubaj@redhat.com> - 1.2.11-16
- Permit a deflateParams() parameter change
- Another fix for Z hardware-accelerated deflate for s390x architectures
- according to previous change by upstream
* Mon Jun 15 2020 Ondrej Dubaj <odubaj@redhat.com> - 1.2.11-15
- Another fix for Z hardware-accelerated deflate for s390x architectures
* Mon May 25 2020 Ondrej Dubaj <odubaj@redhat.com> - 1.2.11-14
- Fix for Z hardware-accelerated deflate for s390x architectures
* Tue Oct 29 2019 Ondrej Dubaj <odubaj@redhat.com> - 1.2.11-13
- Added -DDFLTCC parameter to configure to enable
- Z hardware-accelerated deflate for s390x architectures (#1659433)
* Tue Oct 15 2019 Ondrej Dubaj <odubaj@redhat.com> - 1.2.11-12
- fixed covscan issues
* Mon Oct 14 2019 Ondrej Dubaj <odubaj@redhat.com> - 1.2.11-11
- IBM Z hardware-accelerated deflate for s390x architectures
- IBM CRC32 optimalization for POWER 8+ architectures
- fixed firefox crash due to zlib (#1741266)
- added test for crc32
* Fri Aug 03 2018 Pavel Raiskup <praiskup@redhat.com> - 1.2.11-10
- sync with fedora rawhide
* Fri May 25 2018 Pavel Raiskup <praiskup@redhat.com> - 1.2.11-9
- revert previous aarch64 changes (rhbz#1582444, rhbz#1578798)
* Mon Apr 30 2018 Peter Robinson <pbrobinson@fedoraproject.org> 1.2.11-8
- Optimisations for aarch64
- Minor spec cleanups
* Thu Mar 15 2018 Pavel Raiskup <praiskup@redhat.com> - 1.2.11-7
- don't install crypt.h (rhbz#1424609)
* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.11-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
* Fri Feb 02 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 1.2.11-5
- Switch to %%ldconfig_scriptlets
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.11-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.11-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
* Thu Feb 09 2017 Pavel Raiskup <praiskup@redhat.com> - 1.2.11-2
- fix s390(x) optimizing patch (FTBFS on s390(x))
- simplify ppc64 hack with -O3
* Mon Jan 30 2017 Pavel Raiskup <praiskup@redhat.com> - 1.2.11-1
- latest upstream release (rhbz#1409372)
- cleanup rpmlint
- revert fix for rhbz#985344
- requires with %%_isa tag
- drop zlib Z_BLOCK flush patch (rhbz#1417355)
* Fri Feb 05 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.2.8-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
* Fri Aug 14 2015 Adam Jackson <ajax@redhat.com> 1.2.8-9
- Link with -z now for full RELRO
* Fri Jun 19 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.8-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
* Mon Aug 18 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.8-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
* Wed Aug 6 2014 Tom Callaway <spot@fedoraproject.org> - 1.2.8-6
- fix license handling
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.8-5
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
* Wed Feb 12 2014 jchaloup <jchaloup@redhat.com> - 1.2.8-4
- resolves: #1064213
recompiled with -O3 flag for ppc64 arch
* Sat Aug 10 2013 Kalev Lember <kalevlember@gmail.com> - 1.2.8-3
- resolves: #985344
add a patch to fix missing minizip include
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.8-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
* Fri Jun 7 2013 Peter Schiffer <pschiffe@redhat.com> - 1.2.8-1
- resolves: #957680
updated to 1.2.8
* Fri Feb 15 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.7-10
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
* Thu Oct 4 2012 Peter Schiffer <pschiffe@redhat.com> - 1.2.7-9
- updated patch optimizing deflate on s390(x) architectures
* Wed Aug 29 2012 Peter Schiffer <pschiffe@redhat.com> - 1.2.7-8
- related: #832545
reverted changes for this bug, static libraries shouldn't be compiled with
-fPIC flag
* Mon Aug 27 2012 Peter Schiffer <pschiffe@redhat.com> - 1.2.7-7
- resolves: #844791
rank Z_BLOCK flush below Z_PARTIAL_FLUSH only when last flush was Z_BLOCK
- done some minor .spec file cleanup
* Mon Aug 13 2012 Peter Schiffer <pschiffe@redhat.com> - 1.2.7-6
- added patch from IBM which optimizes deflate on s390(x) architectures
* Thu Aug 02 2012 Peter Schiffer <pschiffe@redhat.com> - 1.2.7-5
- resolves: #832545
recompiled with -fPIC flag
* Sun Jul 22 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.7-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Mon Jun 11 2012 Peter Schiffer <pschiffe@redhat.com> - 1.2.7-3
- moved /lib* to /usr/lib*
* Mon Jun 11 2012 Peter Schiffer <pschiffe@redhat.com> - 1.2.7-2
- recompiled with -Wl,-z,relro flags
* Thu May 10 2012 Peter Schiffer <pschiffe@redhat.com> - 1.2.7-1
- resolves: #785726
- resolves: #805874
update to 1.2.7
* Tue Jan 10 2012 Peter Schiffer <pschiffe@redhat.com> - 1.2.5-6
- resolves: #719139
Zlib fails to read zip64 files on 64-bit system
* Fri Nov 11 2011 Tom Callaway <spot@fedoraproject.org> - 1.2.5-5
- fix minizip to permit uncrypt when NOUNCRYPT is not defined
* Wed Apr 6 2011 Ivana Hutarova Varekova <varekova@redhat.com> - 1.2.5-4
- Resolves: #678603
zlib from minizip allowed NULL pointer parameter of function unzGetCurrentFileInfo
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.5-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
* Wed Jun 16 2010 Ivana Hutarova Varekova <varekova@redhat.com> - 1.2.5-2
- Resolves: #591317
pdfedit fails to compile on i686 with zlib.h errors
* Thu Apr 22 2010 Ivana Hutarova Varekova <varekova@redhat.com> - 1.2.5-1
- update to 1.2.5
* Mon Mar 29 2010 Ivana Hutarova Varekova <varekova@redhat.com> - 1.2.4-1
- update to 1.2.4
use the upstream make/configure files for zlib,
change additional makefile/configure file to be used only to minizip
add pkgconfig to zlib
* Mon Mar 8 2010 Ivana Hutarova Varekova <varekova@redhat.com> - 1.2.3-25
- add Boost license
* Tue Aug 11 2009 Ville Skyttä <ville.skytta@iki.fi> - 1.2.3-24
- Use bzipped upstream tarball.
* Mon Jul 27 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.3-23
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
* Wed Mar 18 2009 Stepan Kasal <skasal@redhat.com> - 1.2.3-22
- fix the libz.so symlink
* Tue Mar 17 2009 Stepan Kasal <skasal@redhat.com> - 1.2.3-21
- consolidate the autoconfiscation patches into one and clean it up
- consequently, clean up the %%build and %%install sections
- zconf.h includes unistd.h again (#479133)
* Wed Feb 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.2.3-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
* Mon Dec 1 2008 Ivana Varekova <varekova@redhat.com> - 1.2.3-19
- fix 473490 - unchecked malloc
* Wed Feb 13 2008 Ivana Varekova <varekova@redhat.com> - 1.2.3-18
- change license tag (226671#c29)
* Mon Feb 11 2008 Ivana Varekova <varekova@redhat.com> - 1.2.3-17
- spec file changes
* Fri Nov 23 2007 Ivana Varekova <varekova@redhat.com> - 1.2.3-16
- remove minizip headers to minizip-devel
- spec file cleanup
- fix minizip.pc file
* Wed Nov 14 2007 Ivana Varekova <varekova@redhat.com> - 1.2.3-15
- separate static subpackage
* Wed Aug 15 2007 Ivana Varekova <varekova@redhat.com> - 1.2.3-14
- create minizip subpackage
* Mon May 21 2007 Ivana Varekova <varekova@redhat.com> - 1.2.3-13
- remove .so,.a
* Mon May 21 2007 Ivana Varekova <varekova@redhat.com> - 1.2.3-12
- Resolves #240277
Move libz to /lib(64)
* Mon Apr 23 2007 Ivana Varekova <varekova@redhat.com> - 1.2.3-11
- Resolves: 237295
fix Summary tag
* Fri Mar 23 2007 Ivana Varekova <varekova@redhat.com> - 1.2.3-10
- remove zlib .so.* packages to /lib
* Fri Mar 9 2007 Ivana Varekova <varekova@redhat.com> - 1.2.3-9
- incorporate package review feedback
* Wed Feb 21 2007 Adam Tkac <atkac redhat com> - 1.2.3-8
- fixed broken version of libz
* Tue Feb 20 2007 Adam Tkac <atkac redhat com> - 1.2.3-7
- building is now automatized
- specfile cleanup
* Tue Feb 20 2007 Ivana Varekova <varekova@redhat.com> - 1.2.3-6
- remove the compilation part to build section
some minor changes
* Mon Feb 19 2007 Ivana Varekova <varekova@redhat.com> - 1.2.3-5
- incorporate package review feedback
* Mon Oct 23 2006 Ivana Varekova <varekova@redhat.com> - 1.2.3-4
- fix #209424 - fix libz.a permissions
* Wed Jul 19 2006 Ivana Varekova <varekova@redhat.com> - 1.2.3-3
- add cflags (#199379)
* Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 1.2.3-2
- rebuild
* Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 1.2.3-1.2.1
- bump again for double-long bug on ppc(64)
* Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 1.2.3-1.2
- rebuilt for new gcc4.1 snapshot and glibc changes
* Fri Dec 09 2005 Jesse Keating <jkeating@redhat.com>
- rebuilt
* Wed Aug 24 2005 Florian La Roche <laroche@redhat.com>
- update to 1.2.3
* Fri Jul 22 2005 Ivana Varekova <varekova@redhat.com> 1.2.2.2-5
- fix bug 163038 - CAN-2005-1849 - zlib buffer overflow
* Thu Jul 7 2005 Ivana Varekova <varekova@redhat.com> 1.2.2.2-4
- fix bug 162392 - CAN-2005-2096
* Wed Mar 30 2005 Ivana Varekova <varekova@redhat.com> 1.2.2.2-3
- fix bug 122408 - zlib build process runs configure twice
* Fri Mar 4 2005 Jeff Johnson <jbj@redhat.com> 1.2.2.2-2
- rebuild with gcc4.
* Sat Jan 1 2005 Jeff Johnson <jbj@jbj.org> 1.2.2.2-1
- upgrade to 1.2.2.2.
* Fri Nov 12 2004 Jeff Johnson <jbj@jbj.org> 1.2.2.1-1
- upgrade to 1.2.2.1.
* Sun Sep 12 2004 Jeff Johnson <jbj@redhat.com> 1.2.1.2-1
- update to 1.2.1.2 to fix 2 DoS problems (#131385).
* Tue Jun 15 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt
* Tue Mar 02 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt
* Fri Feb 13 2004 Elliot Lee <sopwith@redhat.com>
- rebuilt
* Sun Jan 18 2004 Jeff Johnson <jbj@jbj.org> 1.2.1.1-1
- upgrade to zlib-1.2.1.1.
* Sun Nov 30 2003 Florian La Roche <Florian.LaRoche@redhat.de>
- update to 1.2.1 release
* Mon Oct 13 2003 Jeff Johnson <jbj@jbj.org> 1.2.0.7-3
- unrevert zlib.h include constants (#106291), rejected upstream.
* Wed Oct 8 2003 Jeff Johnson <jbj@jbj.org> 1.2.0.7-2
- fix: gzeof not set when reading compressed file (#106424).
- fix: revert zlib.h include constants for now (#106291).
* Tue Sep 23 2003 Jeff Johnson <jbj@redhat.com> 1.2.0.7-1
- update to 1.2.0.7, penultimate 1.2.1 release candidate.
* Tue Jul 22 2003 Jeff Johnson <jbj@redhat.com> 1.2.0.3-0.1
- update to release candidate.
* Wed Jun 04 2003 Elliot Lee <sopwith@redhat.com>
- rebuilt
* Mon May 19 2003 Jeff Johnson <jbj@redhat.com> 1.1.4-9
- rebuild, revert from 1.2.0.1.
* Mon Feb 24 2003 Jeff Johnson <jbj@redhat.com> 1.1.4-8
- fix gzprintf buffer overrun (#84961).
* Wed Jan 22 2003 Tim Powers <timp@redhat.com> 1.1.4-7
- rebuilt
* Thu Nov 21 2002 Elliot Lee <sopwith@redhat.com> 1.1.4-6
- Make ./configure use $CC to ease cross-compilation
* Tue Nov 12 2002 Jeff Johnson <jbj@redhat.com> 1.1.4-5
- rebuild from cvs.
* Fri Jun 21 2002 Tim Powers <timp@redhat.com>
- automated rebuild
* Thu May 23 2002 Tim Powers <timp@redhat.com>
- automated rebuild
* Fri Apr 26 2002 Jakub Jelinek <jakub@redhat.com> 1.1.4-2
- remove glibc patch, it is no longer needed (zlib uses gcc -shared
as it should)
- run tests and only build the package if they succeed
* Thu Apr 25 2002 Trond Eivind Glomsrød <teg@redhat.com> 1.1.4-1
- 1.1.4
* Wed Jan 30 2002 Trond Eivind Glomsrød <teg@redhat.com> 1.1.3-25.7
- Fix double free
* Sun Aug 26 2001 Trond Eivind Glomsrød <teg@redhat.com> 1.1.3-24
- Add example.c and minigzip.c to the doc files, as
they are listed as examples in the README (#52574)
* Mon Jun 18 2001 Trond Eivind Glomsrød <teg@redhat.com>
- Updated URL
- Add version dependency for zlib-devel
- s/Copyright/License/
* Wed Feb 14 2001 Trond Eivind Glomsrød <teg@redhat.com>
- bumped version number - this is the old version without the performance enhancements
* Fri Sep 15 2000 Florian La Roche <Florian.LaRoche@redhat.de>
- add -fPIC for shared libs (patch by Fritz Elfert)
* Thu Sep 7 2000 Jeff Johnson <jbj@redhat.com>
- on 64bit systems, make sure libraries are located correctly.
* Thu Aug 17 2000 Jeff Johnson <jbj@redhat.com>
- summaries from specspo.
* Thu Jul 13 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild
* Sun Jul 02 2000 Trond Eivind Glomsrød <teg@redhat.com>
- rebuild
* Tue Jun 13 2000 Jeff Johnson <jbj@redhat.com>
- FHS packaging to build on solaris2.5.1.
* Wed Jun 07 2000 Trond Eivind Glomsrød <teg@redhat.com>
- use %%{_mandir} and %%{_tmppath}
* Fri May 12 2000 Trond Eivind Glomsrød <teg@redhat.com>
- updated URL and source location
- moved README to main package
* Mon Feb 7 2000 Jeff Johnson <jbj@redhat.com>
- compress man page.
* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com>
- auto rebuild in the new build environment (release 5)
* Wed Sep 09 1998 Cristian Gafton <gafton@redhat.com>
- link against glibc
* Mon Jul 27 1998 Jeff Johnson <jbj@redhat.com>
- upgrade to 1.1.3
* Fri May 08 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr
* Wed Apr 08 1998 Cristian Gafton <gafton@redhat.com>
- upgraded to 1.1.2
- buildroot
* Tue Oct 07 1997 Donnie Barnes <djb@redhat.com>
- added URL tag (down at the moment so it may not be correct)
- made zlib-devel require zlib
* Thu Jun 19 1997 Erik Troan <ewt@redhat.com>
- built against glibc