Accepting request 494524 from devel:libraries:c_c++
1 OBS-URL: https://build.opensuse.org/request/show/494524 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/zlib?expand=0&rev=64
This commit is contained in:
commit
6050515901
@ -3,4 +3,7 @@ libz1
|
||||
provides "zlib-<targettype> = <version>"
|
||||
obsoletes "zlib-<targettype> <= 1.2.8"
|
||||
zlib-devel
|
||||
requires "glibc-devel-<targettype>"
|
||||
requires "libz1-<targettype> = <version>"
|
||||
zlib-devel-static
|
||||
requires "zlib-devel-<targettype> = <version>"
|
||||
|
41
zlib-1.2.11-optimized-s390.patch
Normal file
41
zlib-1.2.11-optimized-s390.patch
Normal file
@ -0,0 +1,41 @@
|
||||
Index: deflate.c
|
||||
===================================================================
|
||||
--- deflate.c.orig
|
||||
+++ 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.
|
3
zlib-1.2.11.tar.gz
Normal file
3
zlib-1.2.11.tar.gz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1
|
||||
size 607698
|
@ -1,105 +0,0 @@
|
||||
# http://mail.madler.net/pipermail/zlib-devel_madler.net/2012-June/002907.html
|
||||
# http://mail.madler.net/pipermail/zlib-devel_madler.net/2012-August/002977.html
|
||||
From: Andreas Krebbel krebbel at linux.vnet.ibm.com
|
||||
Subject: RFC: Improve longest_match performance
|
||||
|
||||
The code currently generated for longest_match looks far from optimal
|
||||
due to a bunch of pointless zero/sign extend instructions.
|
||||
|
||||
By just promoting a few data types in the function I was able to get
|
||||
rid of all but two. The new hotloop is almost half the size of the
|
||||
original version providing quite a performance win for S/390:
|
||||
|
||||
Measured on a zEnterprise z196
|
||||
zlib compiled with upstream GCC 4.8 branch
|
||||
|
||||
32 bit old new
|
||||
|
||||
256MB randomdata: 11.65s 10.92s 6.68%
|
||||
100MB manpages: 4.23s 4.14s 2.17%
|
||||
217MB PDF: 10.54s 9.44s 11.65%
|
||||
|
||||
unaligned ok
|
||||
|
||||
256MB randomdata: 10.90s 10.54s 3.41%
|
||||
100MB manpages: 3.94s 3.87s 1.81%
|
||||
217MB PDF: 8.77s 8.64s 1.50%
|
||||
|
||||
64 bit old new
|
||||
|
||||
256MB randomdata: 11.90s 11.43s 4.11%
|
||||
100MB manpages: 4.51s 4.44s 1.58%
|
||||
217MB PDF: 10.11s 9.89s 2.22%
|
||||
|
||||
unaligned ok
|
||||
|
||||
256MB randomdata: 11.51s 11.15s 3.23%
|
||||
100MB manpages: 4.33s 3.99s 8.52%
|
||||
217MB PDF: 9.81s 9.02s 8.76%
|
||||
|
||||
I also did some measurements on x86 and Power:
|
||||
|
||||
For Power (64 bit, unaligned_ok) an additional zero extend
|
||||
appears. However, the impact is not measurable. There are minor wins
|
||||
and minor regressions. The overall result is flat.
|
||||
|
||||
For Core2 32 bit the patch is a clear winner with up to 9% for the pdf
|
||||
test. Also on 64 bit the code optimized for Core2 gets a bit smaller
|
||||
but unfortunately causes some regressions which I cannot explain.
|
||||
|
||||
For mainframe customers the performance of zlib is very important so I
|
||||
would be very happy to see the patch integrated into upstream
|
||||
zlib. Given that the patch might cause minor regressions on other
|
||||
targets, would it be possible to enable it arch-dependent?
|
||||
|
||||
See below for the patch and some code snippets from my tests.
|
||||
|
||||
Bye,
|
||||
|
||||
-Andreas-
|
||||
|
||||
---
|
||||
deflate.c | 15 ++++++++-------
|
||||
1 file changed, 8 insertions(+), 7 deletions(-)
|
||||
|
||||
Index: zlib-1.2.7/deflate.c
|
||||
===================================================================
|
||||
--- zlib-1.2.7.orig/deflate.c 2012-02-13 01:15:47.000000000 +0100
|
||||
+++ zlib-1.2.7/deflate.c 2012-09-27 13:39:57.942762946 +0200
|
||||
@@ -1143,15 +1143,16 @@
|
||||
/* 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 = 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;
|
||||
@@ -1166,12 +1167,12 @@
|
||||
* 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.
|
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d
|
||||
size 571091
|
@ -1,119 +0,0 @@
|
||||
From 3fb251b363866417122fe54a158a1ac5a7837101 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Adler <madler@alumni.caltech.edu>
|
||||
Date: Wed, 21 Sep 2016 20:07:37 -0700
|
||||
Subject: [PATCH] Remove dummy structure declarations for old buggy compilers.
|
||||
|
||||
While woolly mammoths still roamed the Earth and before Atlantis
|
||||
sunk into the ocean, there were C compilers that could not handle
|
||||
forward structure references, e.g. "struct name;". zlib dutifully
|
||||
provided a work-around for such compilers. That work-around is no
|
||||
longer needed, and, per the recommendation of a security audit of
|
||||
the zlib code by Trail of Bits and TrustInSoft, in support of the
|
||||
Mozilla Foundation, should be removed since what a compiler will
|
||||
do with this is technically undefined. From the report: "there is
|
||||
no telling what interactions the bug could have in the future with
|
||||
link-time optimizations and type-based alias analyses, both
|
||||
features that are present (but not default) in clang."
|
||||
---
|
||||
deflate.c | 4 ----
|
||||
zconf.h | 5 -----
|
||||
zconf.h.cmakein | 5 -----
|
||||
zconf.h.in | 5 -----
|
||||
zlib.h | 5 -----
|
||||
zutil.c | 4 ----
|
||||
6 files changed, 28 deletions(-)
|
||||
|
||||
Index: zlib-1.2.8/deflate.c
|
||||
===================================================================
|
||||
--- zlib-1.2.8.orig/deflate.c
|
||||
+++ zlib-1.2.8/deflate.c
|
||||
@@ -151,10 +151,6 @@ local const config configuration_table[1
|
||||
#define EQUAL 0
|
||||
/* result of memcmp for equal strings */
|
||||
|
||||
-#ifndef NO_DUMMY_DECL
|
||||
-struct static_tree_desc_s {int dummy;}; /* for buggy compilers */
|
||||
-#endif
|
||||
-
|
||||
/* rank Z_BLOCK between Z_NO_FLUSH and Z_PARTIAL_FLUSH */
|
||||
#define RANK(f) (((f) << 1) - ((f) > 4 ? 9 : 0))
|
||||
|
||||
Index: zlib-1.2.8/zconf.h
|
||||
===================================================================
|
||||
--- zlib-1.2.8.orig/zconf.h
|
||||
+++ zlib-1.2.8/zconf.h
|
||||
@@ -224,11 +224,6 @@
|
||||
# define z_const
|
||||
#endif
|
||||
|
||||
-/* Some Mac compilers merge all .h files incorrectly: */
|
||||
-#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
|
||||
-# define NO_DUMMY_DECL
|
||||
-#endif
|
||||
-
|
||||
/* Maximum value for memLevel in deflateInit2 */
|
||||
#ifndef MAX_MEM_LEVEL
|
||||
# ifdef MAXSEG_64K
|
||||
Index: zlib-1.2.8/zconf.h.cmakein
|
||||
===================================================================
|
||||
--- zlib-1.2.8.orig/zconf.h.cmakein
|
||||
+++ zlib-1.2.8/zconf.h.cmakein
|
||||
@@ -226,11 +226,6 @@
|
||||
# define z_const
|
||||
#endif
|
||||
|
||||
-/* Some Mac compilers merge all .h files incorrectly: */
|
||||
-#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
|
||||
-# define NO_DUMMY_DECL
|
||||
-#endif
|
||||
-
|
||||
/* Maximum value for memLevel in deflateInit2 */
|
||||
#ifndef MAX_MEM_LEVEL
|
||||
# ifdef MAXSEG_64K
|
||||
Index: zlib-1.2.8/zconf.h.in
|
||||
===================================================================
|
||||
--- zlib-1.2.8.orig/zconf.h.in
|
||||
+++ zlib-1.2.8/zconf.h.in
|
||||
@@ -224,11 +224,6 @@
|
||||
# define z_const
|
||||
#endif
|
||||
|
||||
-/* Some Mac compilers merge all .h files incorrectly: */
|
||||
-#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
|
||||
-# define NO_DUMMY_DECL
|
||||
-#endif
|
||||
-
|
||||
/* Maximum value for memLevel in deflateInit2 */
|
||||
#ifndef MAX_MEM_LEVEL
|
||||
# ifdef MAXSEG_64K
|
||||
Index: zlib-1.2.8/zlib.h
|
||||
===================================================================
|
||||
--- zlib-1.2.8.orig/zlib.h
|
||||
+++ zlib-1.2.8/zlib.h
|
||||
@@ -1741,11 +1741,6 @@ ZEXTERN int ZEXPORT gzgetc_ OF((gzFile f
|
||||
|
||||
#endif /* !Z_SOLO */
|
||||
|
||||
-/* hack for buggy compilers */
|
||||
-#if !defined(ZUTIL_H) && !defined(NO_DUMMY_DECL)
|
||||
- struct internal_state {int dummy;};
|
||||
-#endif
|
||||
-
|
||||
/* undocumented functions */
|
||||
ZEXTERN const char * ZEXPORT zError OF((int));
|
||||
ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp));
|
||||
Index: zlib-1.2.8/zutil.c
|
||||
===================================================================
|
||||
--- zlib-1.2.8.orig/zutil.c
|
||||
+++ zlib-1.2.8/zutil.c
|
||||
@@ -10,10 +10,6 @@
|
||||
# include "gzguts.h"
|
||||
#endif
|
||||
|
||||
-#ifndef NO_DUMMY_DECL
|
||||
-struct internal_state {int dummy;}; /* for buggy compilers */
|
||||
-#endif
|
||||
-
|
||||
z_const char * const z_errmsg[10] = {
|
||||
"need dictionary", /* Z_NEED_DICT 2 */
|
||||
"stream end", /* Z_STREAM_END 1 */
|
@ -1,224 +0,0 @@
|
||||
From 9aaec95e82117c1cb0f9624264c3618fc380cecb Mon Sep 17 00:00:00 2001
|
||||
From: Mark Adler <madler@alumni.caltech.edu>
|
||||
Date: Wed, 21 Sep 2016 22:25:21 -0700
|
||||
Subject: [PATCH] Use post-increment only in inffast.c.
|
||||
|
||||
An old inffast.c optimization turns out to not be optimal anymore
|
||||
with modern compilers, and furthermore was not compliant with the
|
||||
C standard, for which decrementing a pointer before its allocated
|
||||
memory is undefined. Per the recommendation of a security audit of
|
||||
the zlib code by Trail of Bits and TrustInSoft, in support of the
|
||||
Mozilla Foundation, this "optimization" was removed, in order to
|
||||
avoid the possibility of undefined behavior.
|
||||
---
|
||||
inffast.c | 81 ++++++++++++++++++++++++---------------------------------------
|
||||
1 file changed, 31 insertions(+), 50 deletions(-)
|
||||
|
||||
diff --git a/inffast.c b/inffast.c
|
||||
index bda59ce..f0d163d 100644
|
||||
--- a/inffast.c
|
||||
+++ b/inffast.c
|
||||
@@ -10,25 +10,6 @@
|
||||
|
||||
#ifndef ASMINF
|
||||
|
||||
-/* Allow machine dependent optimization for post-increment or pre-increment.
|
||||
- Based on testing to date,
|
||||
- Pre-increment preferred for:
|
||||
- - PowerPC G3 (Adler)
|
||||
- - MIPS R5000 (Randers-Pehrson)
|
||||
- Post-increment preferred for:
|
||||
- - none
|
||||
- No measurable difference:
|
||||
- - Pentium III (Anderson)
|
||||
- - M68060 (Nikl)
|
||||
- */
|
||||
-#ifdef POSTINC
|
||||
-# define OFF 0
|
||||
-# define PUP(a) *(a)++
|
||||
-#else
|
||||
-# define OFF 1
|
||||
-# define PUP(a) *++(a)
|
||||
-#endif
|
||||
-
|
||||
/*
|
||||
Decode literal, length, and distance codes and write out the resulting
|
||||
literal and match bytes until either not enough input or output is
|
||||
@@ -96,9 +77,9 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||
|
||||
/* copy state to local variables */
|
||||
state = (struct inflate_state FAR *)strm->state;
|
||||
- in = strm->next_in - OFF;
|
||||
+ in = strm->next_in;
|
||||
last = in + (strm->avail_in - 5);
|
||||
- out = strm->next_out - OFF;
|
||||
+ out = strm->next_out;
|
||||
beg = out - (start - strm->avail_out);
|
||||
end = out + (strm->avail_out - 257);
|
||||
#ifdef INFLATE_STRICT
|
||||
@@ -119,9 +100,9 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||
input data or output space */
|
||||
do {
|
||||
if (bits < 15) {
|
||||
- hold += (unsigned long)(PUP(in)) << bits;
|
||||
+ hold += (unsigned long)(*in++) << bits;
|
||||
bits += 8;
|
||||
- hold += (unsigned long)(PUP(in)) << bits;
|
||||
+ hold += (unsigned long)(*in++) << bits;
|
||||
bits += 8;
|
||||
}
|
||||
here = lcode[hold & lmask];
|
||||
@@ -134,14 +115,14 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||
Tracevv((stderr, here.val >= 0x20 && here.val < 0x7f ?
|
||||
"inflate: literal '%c'\n" :
|
||||
"inflate: literal 0x%02x\n", here.val));
|
||||
- PUP(out) = (unsigned char)(here.val);
|
||||
+ *out++ = (unsigned char)(here.val);
|
||||
}
|
||||
else if (op & 16) { /* length base */
|
||||
len = (unsigned)(here.val);
|
||||
op &= 15; /* number of extra bits */
|
||||
if (op) {
|
||||
if (bits < op) {
|
||||
- hold += (unsigned long)(PUP(in)) << bits;
|
||||
+ hold += (unsigned long)(*in++) << bits;
|
||||
bits += 8;
|
||||
}
|
||||
len += (unsigned)hold & ((1U << op) - 1);
|
||||
@@ -150,9 +131,9 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||
}
|
||||
Tracevv((stderr, "inflate: length %u\n", len));
|
||||
if (bits < 15) {
|
||||
- hold += (unsigned long)(PUP(in)) << bits;
|
||||
+ hold += (unsigned long)(*in++) << bits;
|
||||
bits += 8;
|
||||
- hold += (unsigned long)(PUP(in)) << bits;
|
||||
+ hold += (unsigned long)(*in++) << bits;
|
||||
bits += 8;
|
||||
}
|
||||
here = dcode[hold & dmask];
|
||||
@@ -165,10 +146,10 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||
dist = (unsigned)(here.val);
|
||||
op &= 15; /* number of extra bits */
|
||||
if (bits < op) {
|
||||
- hold += (unsigned long)(PUP(in)) << bits;
|
||||
+ hold += (unsigned long)(*in++) << bits;
|
||||
bits += 8;
|
||||
if (bits < op) {
|
||||
- hold += (unsigned long)(PUP(in)) << bits;
|
||||
+ hold += (unsigned long)(*in++) << bits;
|
||||
bits += 8;
|
||||
}
|
||||
}
|
||||
@@ -196,30 +177,30 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||
#ifdef INFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR
|
||||
if (len <= op - whave) {
|
||||
do {
|
||||
- PUP(out) = 0;
|
||||
+ *out++ = 0;
|
||||
} while (--len);
|
||||
continue;
|
||||
}
|
||||
len -= op - whave;
|
||||
do {
|
||||
- PUP(out) = 0;
|
||||
+ *out++ = 0;
|
||||
} while (--op > whave);
|
||||
if (op == 0) {
|
||||
from = out - dist;
|
||||
do {
|
||||
- PUP(out) = PUP(from);
|
||||
+ *out++ = *from++;
|
||||
} while (--len);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
- from = window - OFF;
|
||||
+ from = window;
|
||||
if (wnext == 0) { /* very common case */
|
||||
from += wsize - op;
|
||||
if (op < len) { /* some from window */
|
||||
len -= op;
|
||||
do {
|
||||
- PUP(out) = PUP(from);
|
||||
+ *out++ = *from++;
|
||||
} while (--op);
|
||||
from = out - dist; /* rest from output */
|
||||
}
|
||||
@@ -230,14 +211,14 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||
if (op < len) { /* some from end of window */
|
||||
len -= op;
|
||||
do {
|
||||
- PUP(out) = PUP(from);
|
||||
+ *out++ = *from++;
|
||||
} while (--op);
|
||||
- from = window - OFF;
|
||||
+ from = window;
|
||||
if (wnext < len) { /* some from start of window */
|
||||
op = wnext;
|
||||
len -= op;
|
||||
do {
|
||||
- PUP(out) = PUP(from);
|
||||
+ *out++ = *from++;
|
||||
} while (--op);
|
||||
from = out - dist; /* rest from output */
|
||||
}
|
||||
@@ -248,35 +229,35 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||
if (op < len) { /* some from window */
|
||||
len -= op;
|
||||
do {
|
||||
- PUP(out) = PUP(from);
|
||||
+ *out++ = *from++;
|
||||
} while (--op);
|
||||
from = out - dist; /* rest from output */
|
||||
}
|
||||
}
|
||||
while (len > 2) {
|
||||
- PUP(out) = PUP(from);
|
||||
- PUP(out) = PUP(from);
|
||||
- PUP(out) = PUP(from);
|
||||
+ *out++ = *from++;
|
||||
+ *out++ = *from++;
|
||||
+ *out++ = *from++;
|
||||
len -= 3;
|
||||
}
|
||||
if (len) {
|
||||
- PUP(out) = PUP(from);
|
||||
+ *out++ = *from++;
|
||||
if (len > 1)
|
||||
- PUP(out) = PUP(from);
|
||||
+ *out++ = *from++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
from = out - dist; /* copy direct from output */
|
||||
do { /* minimum length is three */
|
||||
- PUP(out) = PUP(from);
|
||||
- PUP(out) = PUP(from);
|
||||
- PUP(out) = PUP(from);
|
||||
+ *out++ = *from++;
|
||||
+ *out++ = *from++;
|
||||
+ *out++ = *from++;
|
||||
len -= 3;
|
||||
} while (len > 2);
|
||||
if (len) {
|
||||
- PUP(out) = PUP(from);
|
||||
+ *out++ = *from++;
|
||||
if (len > 1)
|
||||
- PUP(out) = PUP(from);
|
||||
+ *out++ = *from++;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -313,8 +294,8 @@ unsigned start; /* inflate()'s starting value for strm->avail_out */
|
||||
hold &= (1U << bits) - 1;
|
||||
|
||||
/* update state and return */
|
||||
- strm->next_in = in + OFF;
|
||||
- strm->next_out = out + OFF;
|
||||
+ strm->next_in = in;
|
||||
+ strm->next_out = out;
|
||||
strm->avail_in = (unsigned)(in < last ? 5 + (last - in) : 5 - (in - last));
|
||||
strm->avail_out = (unsigned)(out < end ?
|
||||
257 + (end - out) : 257 - (out - end));
|
@ -1,71 +0,0 @@
|
||||
From 6a043145ca6e9c55184013841a67b2fef87e44c0 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Adler <madler@alumni.caltech.edu>
|
||||
Date: Wed, 21 Sep 2016 23:35:50 -0700
|
||||
Subject: [PATCH] Remove offset pointer optimization in inftrees.c.
|
||||
|
||||
inftrees.c was subtracting an offset from a pointer to an array,
|
||||
in order to provide a pointer that allowed indexing starting at
|
||||
the offset. This is not compliant with the C standard, for which
|
||||
the behavior of a pointer decremented before its allocated memory
|
||||
is undefined. Per the recommendation of a security audit of the
|
||||
zlib code by Trail of Bits and TrustInSoft, in support of the
|
||||
Mozilla Foundation, this tiny optimization was removed, in order
|
||||
to avoid the possibility of undefined behavior.
|
||||
---
|
||||
inftrees.c | 18 ++++++++----------
|
||||
1 file changed, 8 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/inftrees.c b/inftrees.c
|
||||
index 22fcd66..0d2670d 100644
|
||||
--- a/inftrees.c
|
||||
+++ b/inftrees.c
|
||||
@@ -54,7 +54,7 @@ unsigned short FAR *work;
|
||||
code FAR *next; /* next available space in table */
|
||||
const unsigned short FAR *base; /* base value table to use */
|
||||
const unsigned short FAR *extra; /* extra bits table to use */
|
||||
- int end; /* use base and extra for symbol > end */
|
||||
+ unsigned match; /* use base and extra for symbol >= match */
|
||||
unsigned short count[MAXBITS+1]; /* number of codes of each length */
|
||||
unsigned short offs[MAXBITS+1]; /* offsets in table for each length */
|
||||
static const unsigned short lbase[31] = { /* Length codes 257..285 base */
|
||||
@@ -181,19 +181,17 @@ unsigned short FAR *work;
|
||||
switch (type) {
|
||||
case CODES:
|
||||
base = extra = work; /* dummy value--not used */
|
||||
- end = 19;
|
||||
+ match = 20;
|
||||
break;
|
||||
case LENS:
|
||||
base = lbase;
|
||||
- base -= 257;
|
||||
extra = lext;
|
||||
- extra -= 257;
|
||||
- end = 256;
|
||||
+ match = 257;
|
||||
break;
|
||||
default: /* DISTS */
|
||||
base = dbase;
|
||||
extra = dext;
|
||||
- end = -1;
|
||||
+ match = 0;
|
||||
}
|
||||
|
||||
/* initialize state for loop */
|
||||
@@ -216,13 +214,13 @@ unsigned short FAR *work;
|
||||
for (;;) {
|
||||
/* create table entry */
|
||||
here.bits = (unsigned char)(len - drop);
|
||||
- if ((int)(work[sym]) < end) {
|
||||
+ if (work[sym] + 1 < match) {
|
||||
here.op = (unsigned char)0;
|
||||
here.val = work[sym];
|
||||
}
|
||||
- else if ((int)(work[sym]) > end) {
|
||||
- here.op = (unsigned char)(extra[work[sym]]);
|
||||
- here.val = base[work[sym]];
|
||||
+ else if (work[sym] >= match) {
|
||||
+ here.op = (unsigned char)(extra[work[sym] - match]);
|
||||
+ here.val = base[work[sym] - match];
|
||||
}
|
||||
else {
|
||||
here.op = (unsigned char)(32 + 64); /* end of block */
|
@ -1,29 +0,0 @@
|
||||
From e54e1299404101a5a9d0cf5e45512b543967f958 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Adler <madler@alumni.caltech.edu>
|
||||
Date: Sat, 5 Sep 2015 17:45:55 -0700
|
||||
Subject: [PATCH] Avoid shifts of negative values inflateMark().
|
||||
|
||||
The C standard says that bit shifts of negative integers is
|
||||
undefined. This casts to unsigned values to assure a known
|
||||
result.
|
||||
---
|
||||
inflate.c | 5 +++--
|
||||
1 file changed, 3 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/inflate.c b/inflate.c
|
||||
index 2889e3a..a718416 100644
|
||||
--- a/inflate.c
|
||||
+++ b/inflate.c
|
||||
@@ -1506,9 +1506,10 @@ z_streamp strm;
|
||||
{
|
||||
struct inflate_state FAR *state;
|
||||
|
||||
- if (strm == Z_NULL || strm->state == Z_NULL) return -1L << 16;
|
||||
+ if (strm == Z_NULL || strm->state == Z_NULL)
|
||||
+ return (long)(((unsigned long)0 - 1) << 16);
|
||||
state = (struct inflate_state FAR *)strm->state;
|
||||
- return ((long)(state->back) << 16) +
|
||||
+ return (long)(((unsigned long)((long)state->back)) << 16) +
|
||||
(state->mode == COPY ? state->length :
|
||||
(state->mode == MATCH ? state->was - state->length : 0));
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
From d1d577490c15a0c6862473d7576352a9f18ef811 Mon Sep 17 00:00:00 2001
|
||||
From: Mark Adler <madler@alumni.caltech.edu>
|
||||
Date: Wed, 28 Sep 2016 20:20:25 -0700
|
||||
Subject: [PATCH] Avoid pre-decrement of pointer in big-endian CRC calculation.
|
||||
|
||||
There was a small optimization for PowerPCs to pre-increment a
|
||||
pointer when accessing a word, instead of post-incrementing. This
|
||||
required prefacing the loop with a decrement of the pointer,
|
||||
possibly pointing before the object passed. This is not compliant
|
||||
with the C standard, for which decrementing a pointer before its
|
||||
allocated memory is undefined. When tested on a modern PowerPC
|
||||
with a modern compiler, the optimization no longer has any effect.
|
||||
Due to all that, and per the recommendation of a security audit of
|
||||
the zlib code by Trail of Bits and TrustInSoft, in support of the
|
||||
Mozilla Foundation, this "optimization" was removed, in order to
|
||||
avoid the possibility of undefined behavior.
|
||||
---
|
||||
crc32.c | 4 +---
|
||||
1 file changed, 1 insertion(+), 3 deletions(-)
|
||||
|
||||
diff --git a/crc32.c b/crc32.c
|
||||
index 979a719..05733f4 100644
|
||||
--- a/crc32.c
|
||||
+++ b/crc32.c
|
||||
@@ -278,7 +278,7 @@ local unsigned long crc32_little(crc, buf, len)
|
||||
}
|
||||
|
||||
/* ========================================================================= */
|
||||
-#define DOBIG4 c ^= *++buf4; \
|
||||
+#define DOBIG4 c ^= *buf4++; \
|
||||
c = crc_table[4][c & 0xff] ^ crc_table[5][(c >> 8) & 0xff] ^ \
|
||||
crc_table[6][(c >> 16) & 0xff] ^ crc_table[7][c >> 24]
|
||||
#define DOBIG32 DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4; DOBIG4
|
||||
@@ -300,7 +300,6 @@ local unsigned long crc32_big(crc, buf, len)
|
||||
}
|
||||
|
||||
buf4 = (const z_crc_t FAR *)(const void FAR *)buf;
|
||||
- buf4--;
|
||||
while (len >= 32) {
|
||||
DOBIG32;
|
||||
len -= 32;
|
||||
@@ -309,7 +308,6 @@ local unsigned long crc32_big(crc, buf, len)
|
||||
DOBIG4;
|
||||
len -= 4;
|
||||
}
|
||||
- buf4++;
|
||||
buf = (const unsigned char FAR *)buf4;
|
||||
|
||||
if (len) do {
|
@ -1,12 +1,12 @@
|
||||
From: meissner@suse.de
|
||||
Subject: supply format arguments to gzprintf().
|
||||
|
||||
Index: zlib-1.2.7/zlib.h
|
||||
Index: zlib.h
|
||||
===================================================================
|
||||
--- zlib-1.2.7.orig/zlib.h 2012-05-03 06:12:35.000000000 +0200
|
||||
+++ zlib-1.2.7/zlib.h 2012-09-27 13:12:58.187146312 +0200
|
||||
@@ -1329,7 +1329,11 @@
|
||||
error.
|
||||
--- zlib.h.orig
|
||||
+++ zlib.h
|
||||
@@ -1464,7 +1464,11 @@ ZEXTERN z_size_t ZEXPORT gzfwrite OF((vo
|
||||
is returned, and the error state is set to Z_STREAM_ERROR.
|
||||
*/
|
||||
|
||||
-ZEXTERN int ZEXPORTVA gzprintf Z_ARG((gzFile file, const char *format, ...));
|
||||
|
51
zlib.changes
51
zlib.changes
@ -1,3 +1,54 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed May 10 13:43:08 UTC 2017 - mpluskal@suse.com
|
||||
|
||||
- Add s390 performance patch (fate#314093):
|
||||
* zlib-1.2.11-optimized-s390.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Apr 4 08:31:28 UTC 2017 - schwab@suse.de
|
||||
|
||||
- baselibs.conf: add missing dependencies
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jan 16 09:57:59 UTC 2017 - mpluskal@suse.com
|
||||
|
||||
- Update to version 1.2.11:
|
||||
* Fix deflate stored bug when pulling last block from window
|
||||
* Permit immediate deflateParams changes before any deflate input
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jan 3 07:41:49 UTC 2017 - mpluskal@suse.com
|
||||
|
||||
- Update to version 1.2.10:
|
||||
* Avoid warnings on snprintf() return value
|
||||
* Fix bug in deflate_stored() for zero-length input
|
||||
* Fix bug in gzwrite.c that produced corrupt gzip files
|
||||
* Remove files to be installed before copying them in Makefile.in
|
||||
* Add warnings when compiling with assembler code
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jan 2 09:08:50 UTC 2017 - mpluskal@suse.com
|
||||
|
||||
- Update to version 1.2.9:
|
||||
* Improve compress() and uncompress() to support large lengths
|
||||
* Allow building zlib outside of the source directory
|
||||
* Fix bug when level 0 used with Z_HUFFMAN or Z_RLE
|
||||
* Fix bugs in creating a very large gzip header
|
||||
* Add uncompress2() function, which returns the input size used
|
||||
* Dramatically speed up deflation for level 0 (storing)
|
||||
* Add gzfread() and gzfwrite(), duplicating the interfaces of fread() and fwrite()
|
||||
* Add crc32_z() and adler32_z() functions with size_t lengths
|
||||
* Many portability improvements
|
||||
- Drop patches included in upstream:
|
||||
* zlib-bnc1003577.patch
|
||||
* zlib-bnc1003579-part2.patch
|
||||
* zlib-bnc1003579.patch
|
||||
* zlib-bnc1003580.patch
|
||||
* zlib-bnc1013882.patch
|
||||
- Drop zlib-1.2.7-improve-longest_match-performance.patch
|
||||
* not accepted by upstream for two releases
|
||||
* rebasing no longer possible
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Sun Dec 4 12:47:51 UTC 2016 - tchvatal@suse.com
|
||||
|
||||
|
19
zlib.spec
19
zlib.spec
@ -18,7 +18,7 @@
|
||||
|
||||
%bcond_with profiling
|
||||
Name: zlib
|
||||
Version: 1.2.8
|
||||
Version: 1.2.11
|
||||
Release: 0
|
||||
Summary: Library implementing the DEFLATE compression algorithm
|
||||
License: Zlib
|
||||
@ -29,15 +29,9 @@ Source1: LICENSE
|
||||
Source2: baselibs.conf
|
||||
Source3: zlib-rpmlintrc
|
||||
#PATCH-FIX-SUSE: fate#314093, sent upstream by IBM
|
||||
Patch0: zlib-1.2.7-improve-longest_match-performance.patch
|
||||
Patch0: zlib-1.2.11-optimized-s390.patch
|
||||
#PATCH-FIX-SUSE: compiler check of varguments passed to gzprintf
|
||||
Patch1: zlib-format.patch
|
||||
# PATCH-FIX-UPSTREAM: security fixes from upstream git
|
||||
Patch2: zlib-bnc1003577.patch
|
||||
Patch3: zlib-bnc1003579-part2.patch
|
||||
Patch4: zlib-bnc1003579.patch
|
||||
Patch5: zlib-bnc1003580.patch
|
||||
Patch6: zlib-bnc1013882.patch
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
BuildRequires: libtool
|
||||
@ -119,13 +113,8 @@ developing applications which use minizip.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
%patch0
|
||||
%patch1
|
||||
|
||||
%build
|
||||
export LDFLAGS="-Wl,-z,relro,-z,now"
|
||||
|
Loading…
Reference in New Issue
Block a user