SHA256
1
0
forked from pool/zlib
Tomáš Chvátal 2019-06-06 09:47:36 +00:00 committed by Git OBS Bridge
parent 93bd7af12d
commit d78414383d
2 changed files with 88 additions and 90 deletions

175
410.patch
View File

@ -110,10 +110,10 @@ updatewindow and made ZLIB_INTERNAL.
create mode 100644 contrib/s390/dfltcc.h
create mode 100644 contrib/s390/dfltcc_deflate.h
diff --git a/Makefile.in b/Makefile.in
index 3413266a..6c28f1f7 100644
--- a/Makefile.in
+++ b/Makefile.in
Index: zlib-1.2.11/Makefile.in
===================================================================
--- zlib-1.2.11.orig/Makefile.in
+++ zlib-1.2.11/Makefile.in
@@ -143,6 +143,14 @@ match.lo: match.S
mv _match.o match.lo
rm -f _match.s
@ -129,11 +129,11 @@ index 3413266a..6c28f1f7 100644
example.o: $(SRCDIR)test/example.c $(SRCDIR)zlib.h zconf.h
$(CC) $(CFLAGS) $(ZINCOUT) -c -o $@ $(SRCDIR)test/example.c
diff --git a/configure b/configure
index 1cd4fe57..a2907229 100755
--- a/configure
+++ b/configure
@@ -822,6 +822,19 @@ EOF
Index: zlib-1.2.11/configure
===================================================================
--- zlib-1.2.11.orig/configure
+++ zlib-1.2.11/configure
@@ -911,6 +911,19 @@ EOF
fi
fi
@ -153,11 +153,10 @@ index 1cd4fe57..a2907229 100755
# show the results in the log
echo >> configure.log
echo ALL = $ALL >> configure.log
diff --git a/contrib/s390/dfltcc.c b/contrib/s390/dfltcc.c
new file mode 100644
index 00000000..7989ad29
Index: zlib-1.2.11/contrib/s390/dfltcc.c
===================================================================
--- /dev/null
+++ b/contrib/s390/dfltcc.c
+++ zlib-1.2.11/contrib/s390/dfltcc.c
@@ -0,0 +1,898 @@
+/* dfltcc.c - SystemZ DEFLATE CONVERSION CALL support. */
+
@ -1057,11 +1056,10 @@ index 00000000..7989ad29
+ *dict_length = param->hl;
+ return Z_OK;
+}
diff --git a/contrib/s390/dfltcc.h b/contrib/s390/dfltcc.h
new file mode 100644
index 00000000..e4447dd9
Index: zlib-1.2.11/contrib/s390/dfltcc.h
===================================================================
--- /dev/null
+++ b/contrib/s390/dfltcc.h
+++ zlib-1.2.11/contrib/s390/dfltcc.h
@@ -0,0 +1,55 @@
+#ifndef DFLTCC_H
+#define DFLTCC_H
@ -1118,11 +1116,10 @@ index 00000000..e4447dd9
+ } while (0)
+
+#endif
diff --git a/contrib/s390/dfltcc_deflate.h b/contrib/s390/dfltcc_deflate.h
new file mode 100644
index 00000000..970d37c1
Index: zlib-1.2.11/contrib/s390/dfltcc_deflate.h
===================================================================
--- /dev/null
+++ b/contrib/s390/dfltcc_deflate.h
+++ zlib-1.2.11/contrib/s390/dfltcc_deflate.h
@@ -0,0 +1,50 @@
+#ifndef DFLTCC_DEFLATE_H
+#define DFLTCC_DEFLATE_H
@ -1174,10 +1171,10 @@ index 00000000..970d37c1
+#define DEFLATE_NEED_CHECKSUM(strm) (!dfltcc_can_deflate((strm)))
+
+#endif
diff --git a/deflate.c b/deflate.c
index 23aef187..bc8b33ea 100644
--- a/deflate.c
+++ b/deflate.c
Index: zlib-1.2.11/deflate.c
===================================================================
--- zlib-1.2.11.orig/deflate.c
+++ zlib-1.2.11/deflate.c
@@ -61,15 +61,29 @@ const char deflate_copyright[] =
*/
@ -1215,7 +1212,7 @@ index 23aef187..bc8b33ea 100644
typedef block_state (*compress_func) OF((deflate_state *s, int flush));
/* Compression function. Returns the block state after the call. */
@@ -85,7 +99,6 @@ local block_state deflate_rle OF((deflate_state *s, int flush));
@@ -85,7 +99,6 @@ local block_state deflate_rle OF((def
local block_state deflate_huff OF((deflate_state *s, int flush));
local void lm_init OF((deflate_state *s));
local void putShortMSB OF((deflate_state *s, uInt b));
@ -1223,7 +1220,7 @@ index 23aef187..bc8b33ea 100644
local unsigned read_buf OF((z_streamp strm, Bytef *buf, unsigned size));
#ifdef ASMV
# pragma message("Assembler code may have bugs -- use at your own risk")
@@ -299,7 +312,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
@@ -301,7 +314,7 @@ int ZEXPORT deflateInit2_(strm, level, m
return Z_STREAM_ERROR;
}
if (windowBits == 8) windowBits = 9; /* until 256-byte window bug fixed */
@ -1232,7 +1229,7 @@ index 23aef187..bc8b33ea 100644
if (s == Z_NULL) return Z_MEM_ERROR;
strm->state = (struct internal_state FAR *)s;
s->strm = strm;
@@ -316,7 +329,7 @@ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy,
@@ -318,7 +331,7 @@ int ZEXPORT deflateInit2_(strm, level, m
s->hash_mask = s->hash_size - 1;
s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH);
@ -1241,7 +1238,7 @@ index 23aef187..bc8b33ea 100644
s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos));
s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos));
@@ -434,6 +447,7 @@ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength)
@@ -394,6 +407,7 @@ int ZEXPORT deflateSetDictionary (strm,
/* when using zlib wrappers, compute Adler-32 for provided dictionary */
if (wrap == 1)
strm->adler = adler32(strm->adler, dictionary, dictLength);
@ -1249,7 +1246,7 @@ index 23aef187..bc8b33ea 100644
s->wrap = 0; /* avoid computing Adler-32 in read_buf */
/* if dictionary would fill window, just replace the history */
@@ -492,6 +506,7 @@ int ZEXPORT deflateGetDictionary (strm, dictionary, dictLength)
@@ -452,6 +466,7 @@ int ZEXPORT deflateGetDictionary (strm,
if (deflateStateCheck(strm))
return Z_STREAM_ERROR;
@ -1257,7 +1254,7 @@ index 23aef187..bc8b33ea 100644
s = strm->state;
len = s->strstart + s->lookahead;
if (len > s->w_size)
@@ -538,6 +553,8 @@ int ZEXPORT deflateResetKeep (strm)
@@ -498,6 +513,8 @@ int ZEXPORT deflateResetKeep (strm)
_tr_init(s);
@ -1266,7 +1263,7 @@ index 23aef187..bc8b33ea 100644
return Z_OK;
}
@@ -625,6 +642,7 @@ int ZEXPORT deflateParams(strm, level, strategy)
@@ -584,6 +601,7 @@ int ZEXPORT deflateParams(strm, level, s
if (level < 0 || level > 9 || strategy < 0 || strategy > Z_FIXED) {
return Z_STREAM_ERROR;
}
@ -1274,7 +1271,7 @@ index 23aef187..bc8b33ea 100644
func = configuration_table[s->level].func;
if ((strategy != s->strategy || func != configuration_table[level].func) &&
@@ -700,6 +718,7 @@ uLong ZEXPORT deflateBound(strm, sourceLen)
@@ -659,6 +677,7 @@ uLong ZEXPORT deflateBound(strm, sourceL
/* conservative upper bound for compressed data */
complen = sourceLen +
((sourceLen + 7) >> 3) + ((sourceLen + 63) >> 6) + 5;
@ -1282,7 +1279,7 @@ index 23aef187..bc8b33ea 100644
/* if can't get parameters, return conservative bound plus zlib wrapper */
if (deflateStateCheck(strm))
@@ -741,7 +760,8 @@ uLong ZEXPORT deflateBound(strm, sourceLen)
@@ -700,7 +719,8 @@ uLong ZEXPORT deflateBound(strm, sourceL
}
/* if not default parameters, return conservative bound */
@ -1292,7 +1289,7 @@ index 23aef187..bc8b33ea 100644
return complen + wraplen;
/* default settings: return tight bound for that case */
@@ -768,7 +788,7 @@ local void putShortMSB (s, b)
@@ -727,7 +747,7 @@ local void putShortMSB (s, b)
* applications may wish to modify it to avoid allocating a large
* strm->next_out buffer and copying into it. (See also read_buf()).
*/
@ -1301,7 +1298,7 @@ index 23aef187..bc8b33ea 100644
z_streamp strm;
{
unsigned len;
@@ -1040,7 +1060,8 @@ int ZEXPORT deflate (strm, flush)
@@ -997,7 +1017,8 @@ int ZEXPORT deflate (strm, flush)
(flush != Z_NO_FLUSH && s->status != FINISH_STATE)) {
block_state bstate;
@ -1311,7 +1308,7 @@ index 23aef187..bc8b33ea 100644
s->strategy == Z_HUFFMAN_ONLY ? deflate_huff(s, flush) :
s->strategy == Z_RLE ? deflate_rle(s, flush) :
(*(configuration_table[s->level].func))(s, flush);
@@ -1129,9 +1150,9 @@ int ZEXPORT deflateEnd (strm)
@@ -1086,9 +1107,9 @@ int ZEXPORT deflateEnd (strm)
TRY_FREE(strm, strm->state->pending_buf);
TRY_FREE(strm, strm->state->head);
TRY_FREE(strm, strm->state->prev);
@ -1323,7 +1320,7 @@ index 23aef187..bc8b33ea 100644
strm->state = Z_NULL;
return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK;
@@ -1161,13 +1182,13 @@ int ZEXPORT deflateCopy (dest, source)
@@ -1119,13 +1140,13 @@ int ZEXPORT deflateCopy (dest, source)
zmemcpy((voidpf)dest, (voidpf)source, sizeof(z_stream));
@ -1339,8 +1336,8 @@ index 23aef187..bc8b33ea 100644
+ ds->window = (Bytef *) ZALLOC_WINDOW(dest, ds->w_size, 2*sizeof(Byte));
ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos));
ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos));
ds->pending_buf = (uchf *) ZALLOC(dest, ds->lit_bufsize, 4);
@@ -1214,7 +1235,8 @@ local unsigned read_buf(strm, buf, size)
overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2);
@@ -1174,7 +1195,8 @@ local unsigned read_buf(strm, buf, size)
strm->avail_in -= len;
zmemcpy(buf, strm->next_in, len);
@ -1350,11 +1347,11 @@ index 23aef187..bc8b33ea 100644
strm->adler = adler32(strm->adler, buf, len);
}
#ifdef GZIP
diff --git a/deflate.h b/deflate.h
index d4cf1a98..79c2057e 100644
--- a/deflate.h
+++ b/deflate.h
@@ -299,6 +299,7 @@ void ZLIB_INTERNAL _tr_flush_bits OF((deflate_state *s));
Index: zlib-1.2.11/deflate.h
===================================================================
--- zlib-1.2.11.orig/deflate.h
+++ zlib-1.2.11/deflate.h
@@ -304,6 +304,7 @@ void ZLIB_INTERNAL _tr_flush_bits OF((de
void ZLIB_INTERNAL _tr_align OF((deflate_state *s));
void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
ulg stored_len, int last));
@ -1362,7 +1359,7 @@ index d4cf1a98..79c2057e 100644
#define d_code(dist) \
((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
@@ -343,4 +344,15 @@ void ZLIB_INTERNAL _tr_stored_block OF((deflate_state *s, charf *buf,
@@ -346,4 +347,15 @@ void ZLIB_INTERNAL _tr_stored_block OF((
flush = _tr_tally(s, distance, length)
#endif
@ -1378,10 +1375,10 @@ index d4cf1a98..79c2057e 100644
+void ZLIB_INTERNAL flush_pending OF((z_streamp strm));
+
#endif /* DEFLATE_H */
diff --git a/gzguts.h b/gzguts.h
index fc712dc4..045815cb 100644
--- a/gzguts.h
+++ b/gzguts.h
Index: zlib-1.2.11/gzguts.h
===================================================================
--- zlib-1.2.11.orig/gzguts.h
+++ zlib-1.2.11/gzguts.h
@@ -153,7 +153,11 @@
/* default i/o buffer size -- double this for output when reading (this and
@ -1394,10 +1391,10 @@ index fc712dc4..045815cb 100644
/* gzip modes, also provide a little integrity check on the passed structure */
#define GZ_NONE 0
diff --git a/inflate.c b/inflate.c
index 2c1b17f1..2b7d5648 100644
--- a/inflate.c
+++ b/inflate.c
Index: zlib-1.2.11/inflate.c
===================================================================
--- zlib-1.2.11.orig/inflate.c
+++ zlib-1.2.11/inflate.c
@@ -85,6 +85,23 @@
#include "inflate.h"
#include "inffast.h"
@ -1422,7 +1419,7 @@ index 2c1b17f1..2b7d5648 100644
#ifdef MAKEFIXED
# ifndef BUILDFIXED
# define BUILDFIXED
@@ -138,6 +155,7 @@ z_streamp strm;
@@ -137,6 +154,7 @@ z_streamp strm;
state->lencode = state->distcode = state->next = state->codes;
state->sane = 1;
state->back = -1;
@ -1430,7 +1427,7 @@ index 2c1b17f1..2b7d5648 100644
Tracev((stderr, "inflate: reset\n"));
return Z_OK;
}
@@ -183,7 +201,7 @@ int windowBits;
@@ -182,7 +200,7 @@ int windowBits;
if (windowBits && (windowBits < 8 || windowBits > 15))
return Z_STREAM_ERROR;
if (state->window != Z_NULL && state->wbits != (unsigned)windowBits) {
@ -1439,7 +1436,7 @@ index 2c1b17f1..2b7d5648 100644
state->window = Z_NULL;
}
@@ -222,7 +240,7 @@ int stream_size;
@@ -221,7 +239,7 @@ int stream_size;
strm->zfree = zcfree;
#endif
state = (struct inflate_state FAR *)
@ -1448,7 +1445,7 @@ index 2c1b17f1..2b7d5648 100644
if (state == Z_NULL) return Z_MEM_ERROR;
Tracev((stderr, "inflate: allocated\n"));
strm->state = (struct internal_state FAR *)state;
@@ -231,7 +249,7 @@ int stream_size;
@@ -230,7 +248,7 @@ int stream_size;
state->mode = HEAD; /* to pass state test in inflateReset2() */
ret = inflateReset2(strm, windowBits);
if (ret != Z_OK) {
@ -1457,7 +1454,7 @@ index 2c1b17f1..2b7d5648 100644
strm->state = Z_NULL;
}
return ret;
@@ -253,6 +271,7 @@ int value;
@@ -252,6 +270,7 @@ int value;
struct inflate_state FAR *state;
if (inflateStateCheck(strm)) return Z_STREAM_ERROR;
@ -1465,7 +1462,7 @@ index 2c1b17f1..2b7d5648 100644
state = (struct inflate_state FAR *)strm->state;
if (bits < 0) {
state->hold = 0;
@@ -380,6 +399,27 @@ void makefixed()
@@ -379,6 +398,27 @@ void makefixed()
}
#endif /* MAKEFIXED */
@ -1493,7 +1490,7 @@ index 2c1b17f1..2b7d5648 100644
/*
Update the window with the last wsize (normally 32K) bytes written before
returning. If window does not exist yet, create it. This is only called
@@ -404,20 +444,7 @@ unsigned copy;
@@ -403,20 +443,7 @@ unsigned copy;
state = (struct inflate_state FAR *)strm->state;
@ -1515,7 +1512,7 @@ index 2c1b17f1..2b7d5648 100644
/* copy state->wsize or less output bytes into the circular window */
if (copy >= state->wsize) {
@@ -850,6 +877,7 @@ int flush;
@@ -849,6 +876,7 @@ int flush;
case TYPE:
if (flush == Z_BLOCK || flush == Z_TREES) goto inf_leave;
case TYPEDO:
@ -1523,7 +1520,7 @@ index 2c1b17f1..2b7d5648 100644
if (state->last) {
BYTEBITS();
state->mode = CHECK;
@@ -1201,7 +1229,7 @@ int flush;
@@ -1200,7 +1228,7 @@ int flush;
out -= left;
strm->total_out += out;
state->total += out;
@ -1532,7 +1529,7 @@ index 2c1b17f1..2b7d5648 100644
strm->adler = state->check =
UPDATE(state->check, put - out, out);
out = left;
@@ -1253,8 +1281,9 @@ int flush;
@@ -1252,8 +1280,9 @@ int flush;
*/
inf_leave:
RESTORE();
@ -1544,7 +1541,7 @@ index 2c1b17f1..2b7d5648 100644
if (updatewindow(strm, strm->next_out, out - strm->avail_out)) {
state->mode = MEM;
return Z_MEM_ERROR;
@@ -1264,7 +1293,7 @@ int flush;
@@ -1263,7 +1292,7 @@ int flush;
strm->total_in += in;
strm->total_out += out;
state->total += out;
@ -1553,7 +1550,7 @@ index 2c1b17f1..2b7d5648 100644
strm->adler = state->check =
UPDATE(state->check, strm->next_out - out, out);
strm->data_type = (int)state->bits + (state->last ? 64 : 0) +
@@ -1282,8 +1311,8 @@ z_streamp strm;
@@ -1281,8 +1310,8 @@ z_streamp strm;
if (inflateStateCheck(strm))
return Z_STREAM_ERROR;
state = (struct inflate_state FAR *)strm->state;
@ -1564,7 +1561,7 @@ index 2c1b17f1..2b7d5648 100644
strm->state = Z_NULL;
Tracev((stderr, "inflate: end\n"));
return Z_OK;
@@ -1482,21 +1511,22 @@ z_streamp source;
@@ -1474,21 +1503,22 @@ z_streamp source;
/* allocate space */
copy = (struct inflate_state FAR *)
@ -1591,7 +1588,7 @@ index 2c1b17f1..2b7d5648 100644
copy->strm = dest;
if (state->lencode >= state->codes &&
state->lencode <= state->codes + ENOUGH - 1) {
@@ -1553,6 +1583,7 @@ z_streamp strm;
@@ -1545,6 +1575,7 @@ z_streamp strm;
if (inflateStateCheck(strm))
return -(1L << 16);
@ -1599,20 +1596,20 @@ index 2c1b17f1..2b7d5648 100644
state = (struct inflate_state FAR *)strm->state;
return (long)(((unsigned long)((long)state->back)) << 16) +
(state->mode == COPY ? state->length :
diff --git a/inflate.h b/inflate.h
index 98679fa9..b14e56dd 100644
--- a/inflate.h
+++ b/inflate.h
@@ -124,3 +124,5 @@ struct inflate_state {
Index: zlib-1.2.11/inflate.h
===================================================================
--- zlib-1.2.11.orig/inflate.h
+++ zlib-1.2.11/inflate.h
@@ -123,3 +123,5 @@ struct inflate_state {
int back; /* bits back of last unprocessed length/lit */
unsigned was; /* initial length of match */
};
+
+int ZLIB_INTERNAL inflate_ensure_window OF((struct inflate_state *state));
diff --git a/test/infcover.c b/test/infcover.c
index 2be01646..a34cd17a 100644
--- a/test/infcover.c
+++ b/test/infcover.c
Index: zlib-1.2.11/test/infcover.c
===================================================================
--- zlib-1.2.11.orig/test/infcover.c
+++ zlib-1.2.11/test/infcover.c
@@ -444,7 +444,7 @@ local void cover_wrap(void)
}
@ -1622,10 +1619,10 @@ index 2be01646..a34cd17a 100644
{
static unsigned int next = 0;
static unsigned char dat[] = {0x63, 0, 2, 0};
diff --git a/test/minigzip.c b/test/minigzip.c
index e22fb08c..4b5f4efe 100644
--- a/test/minigzip.c
+++ b/test/minigzip.c
Index: zlib-1.2.11/test/minigzip.c
===================================================================
--- zlib-1.2.11.orig/test/minigzip.c
+++ zlib-1.2.11/test/minigzip.c
@@ -132,7 +132,11 @@ static void pwinerror (s)
#endif
#define SUFFIX_LEN (sizeof(GZ_SUFFIX)-1)
@ -1638,15 +1635,15 @@ index e22fb08c..4b5f4efe 100644
#define MAX_NAME_LEN 1024
#ifdef MAXSEG_64K
diff --git a/trees.c b/trees.c
index decaeb7c..3f749d83 100644
--- a/trees.c
+++ b/trees.c
@@ -149,8 +149,6 @@ local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes,
Index: zlib-1.2.11/trees.c
===================================================================
--- zlib-1.2.11.orig/trees.c
+++ zlib-1.2.11/trees.c
@@ -149,8 +149,6 @@ local void send_all_trees OF((deflate_st
local void compress_block OF((deflate_state *s, const ct_data *ltree,
const ct_data *dtree));
local int detect_data_type OF((deflate_state *s));
-local unsigned bi_reverse OF((unsigned code, int len));
-local unsigned bi_reverse OF((unsigned value, int length));
-local void bi_windup OF((deflate_state *s));
local void bi_flush OF((deflate_state *s));
@ -1665,7 +1662,7 @@ index decaeb7c..3f749d83 100644
/* the arguments must not have side effects */
@@ -1134,7 +1139,7 @@ local int detect_data_type(s)
@@ -1155,7 +1160,7 @@ local int detect_data_type(s)
* method would use a table)
* IN assertion: 1 <= len <= 15
*/
@ -1674,7 +1671,7 @@ index decaeb7c..3f749d83 100644
unsigned code; /* the value to invert */
int len; /* its bit length */
{
@@ -1166,7 +1171,7 @@ local void bi_flush(s)
@@ -1187,7 +1192,7 @@ local void bi_flush(s)
/* ===========================================================================
* Flush the bit buffer and align the output on a byte boundary
*/

View File

@ -38,7 +38,7 @@ Patch2: 0001-Do-not-try-to-store-negative-values-in-unsigned-int.patch
#PATCH-FIX-UPSTREAM https://github.com/madler/zlib/pull/335
Patch3: zlib-power8-fate325307.patch
#PATCH-FIX-UPSTREAM https://github.com/madler/zlib/pull/410
Patch4: https://patch-diff.githubusercontent.com/raw/madler/zlib/pull/410.patch
Patch4: 410.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: libtool
@ -123,6 +123,7 @@ developing applications which use minizip.
%patch1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%build
export LDFLAGS="-Wl,-z,relro,-z,now"