Adapt Compress::Raw::Zlib to zlib-1.2.11
This commit is contained in:
parent
2fa0b0b374
commit
25eec2bc83
@ -1,94 +0,0 @@
|
||||
From b42f5c088158f473116d3aca2d050d4efb95b021 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
||||
Date: Tue, 7 Feb 2017 14:44:48 +0100
|
||||
Subject: [PATCH] Adapt tests to zlib 1.2.11
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Since zlib-1.2.9 it's not safe to invoke deflateParams() when not all
|
||||
input was consumed by deflate(). deflateParams() could return
|
||||
Z_BUF_ERROR in some cases:
|
||||
|
||||
commit 7161ad76e2d0ac7de2a6235fcad3b9dfc99e9140
|
||||
Author: Mark Adler <madler@alumni.caltech.edu>
|
||||
Date: Tue Nov 22 23:29:19 2016 -0800
|
||||
|
||||
Assure that deflateParams() will not switch functions mid-block.
|
||||
|
||||
This alters the specification in zlib.h, so that deflateParams()
|
||||
will not change any parameters if there is not enough output space
|
||||
in the event that a block is emitted in order to allow switching
|
||||
the compression function.
|
||||
|
||||
zlib documentation recommends two fixes:
|
||||
|
||||
To retry deflateParams() as it processes a piece of input underneath
|
||||
until something else than Z_BUF_ERROR is returned. However this does
|
||||
not work for me because then the compressed stream gets corrupted
|
||||
and the subsequent inflate() returns a failure.
|
||||
|
||||
Another fix is to flush the deflated stream with Z_BLOCK just before
|
||||
any deflateParams() call that follows unifinished deflate(). This
|
||||
assures the new deflate options will be applied immediatelly on next
|
||||
deflate() call. This fix works for me. Thus I implemented it in the
|
||||
tests.
|
||||
|
||||
The new tests pass with zlib 1.2.8 as well as 1.2.11. 1.2.9 and 1.2.10
|
||||
seems broken changing the deflate options was fixed in 1.2.11.
|
||||
|
||||
CPAN RT#119762
|
||||
|
||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||
---
|
||||
t/02zlib.t | 9 ++++++---
|
||||
1 file changed, 6 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/t/02zlib.t b/t/02zlib.t
|
||||
index 2c9aad6..50f6a82 100644
|
||||
--- a/t/02zlib.t
|
||||
+++ b/t/02zlib.t
|
||||
@@ -24,13 +24,13 @@ BEGIN
|
||||
|
||||
my $count = 0 ;
|
||||
if ($] < 5.005) {
|
||||
- $count = 232 ;
|
||||
+ $count = 236 ;
|
||||
}
|
||||
elsif ($] >= 5.006) {
|
||||
- $count = 317 ;
|
||||
+ $count = 320 ;
|
||||
}
|
||||
else {
|
||||
- $count = 275 ;
|
||||
+ $count = 278 ;
|
||||
}
|
||||
|
||||
plan tests => $count + $extra;
|
||||
@@ -537,6 +537,7 @@ SKIP:
|
||||
|
||||
$status = $x->deflate($hello, $Answer) ;
|
||||
cmp_ok $status, '==', Z_OK ;
|
||||
+ cmp_ok $x->flush($Answer, Z_BLOCK), '==', Z_OK ;
|
||||
$input .= $hello;
|
||||
|
||||
# error cases
|
||||
@@ -561,6 +562,7 @@ SKIP:
|
||||
|
||||
$status = $x->deflate($goodbye, $Answer) ;
|
||||
cmp_ok $status, '==', Z_OK ;
|
||||
+ cmp_ok $x->flush($Answer, Z_BLOCK), '==', Z_OK ;
|
||||
$input .= $goodbye;
|
||||
|
||||
# change only Level
|
||||
@@ -572,6 +574,7 @@ SKIP:
|
||||
|
||||
$status = $x->deflate($goodbye, $Answer) ;
|
||||
cmp_ok $status, '==', Z_OK ;
|
||||
+ cmp_ok $x->flush($Answer, Z_BLOCK), '==', Z_OK ;
|
||||
$input .= $goodbye;
|
||||
|
||||
# change only Strategy
|
||||
--
|
||||
2.7.4
|
||||
|
367
Compress-Raw-Zlib-2.071-Adapt-to-zlib-1.2.11.patch
Normal file
367
Compress-Raw-Zlib-2.071-Adapt-to-zlib-1.2.11.patch
Normal file
@ -0,0 +1,367 @@
|
||||
From 0c7af9e6cb05b436505e7f46ef49dcb6f791f30a Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
||||
Date: Fri, 17 Feb 2017 11:00:21 +0100
|
||||
Subject: [PATCH] Adapt to zlib-1.2.11
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
This is a fix ported from Compress-Raw-Zlib-2.072 that restores
|
||||
compatibility with zlib-1.2.11.
|
||||
|
||||
CPAN RT#119762
|
||||
|
||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||
---
|
||||
Zlib.xs | 220 +++++++++++++++++++++++++++++++++++++++++++++++--------------
|
||||
t/02zlib.t | 11 +++-
|
||||
2 files changed, 178 insertions(+), 53 deletions(-)
|
||||
|
||||
diff --git a/Zlib.xs b/Zlib.xs
|
||||
index d379f78..83d1423 100644
|
||||
--- a/Zlib.xs
|
||||
+++ b/Zlib.xs
|
||||
@@ -74,6 +74,10 @@
|
||||
# define AT_LEAST_ZLIB_1_2_8
|
||||
#endif
|
||||
|
||||
+#if defined(ZLIB_VERNUM) && ZLIB_VERNUM >= 0x1290
|
||||
+# define AT_LEAST_ZLIB_1_2_9
|
||||
+#endif
|
||||
+
|
||||
#ifdef USE_PPPORT_H
|
||||
# define NEED_sv_2pvbyte
|
||||
# define NEED_sv_2pv_nolen
|
||||
@@ -134,12 +138,13 @@ typedef struct di_stream {
|
||||
uLong dict_adler ;
|
||||
int last_error ;
|
||||
bool zip_mode ;
|
||||
-#define SETP_BYTE
|
||||
+/* #define SETP_BYTE */
|
||||
#ifdef SETP_BYTE
|
||||
+ /* SETP_BYTE only works with zlib up to 1.2.8 */
|
||||
bool deflateParams_out_valid ;
|
||||
Bytef deflateParams_out_byte;
|
||||
#else
|
||||
-#define deflateParams_BUFFER_SIZE 0x4000
|
||||
+#define deflateParams_BUFFER_SIZE 0x40000
|
||||
uLong deflateParams_out_length;
|
||||
Bytef* deflateParams_out_buffer;
|
||||
#endif
|
||||
@@ -636,6 +641,103 @@ char * string ;
|
||||
return sv ;
|
||||
}
|
||||
|
||||
+#if 0
|
||||
+int
|
||||
+flushToBuffer(di_stream* s, int flush)
|
||||
+{
|
||||
+ dTHX;
|
||||
+ int ret ;
|
||||
+ z_stream * strm = &s->stream;
|
||||
+
|
||||
+ Bytef* output = s->deflateParams_out_buffer ;
|
||||
+
|
||||
+ strm->next_in = NULL;
|
||||
+ strm->avail_in = 0;
|
||||
+
|
||||
+ uLong total_output = 0;
|
||||
+ uLong have = 0;
|
||||
+
|
||||
+ do
|
||||
+ {
|
||||
+ if (output)
|
||||
+ output = (unsigned char *)saferealloc(output, total_output + s->bufsize);
|
||||
+ else
|
||||
+ output = (unsigned char *)safemalloc(s->bufsize);
|
||||
+
|
||||
+ strm->next_out = output + total_output;
|
||||
+ strm->avail_out = s->bufsize;
|
||||
+
|
||||
+ ret = deflate(strm, flush); /* no bad return value */
|
||||
+ //assert(ret != Z_STREAM_ERROR); /* state not clobbered */
|
||||
+ if(ret == Z_STREAM_ERROR)
|
||||
+ {
|
||||
+ safefree(output);
|
||||
+ return ret;
|
||||
+ }
|
||||
+ have = s->bufsize - strm->avail_out;
|
||||
+ total_output += have;
|
||||
+
|
||||
+ //fprintf(stderr, "FLUSH %s %d, return %d\n", flush_flags[flush], have, ret);
|
||||
+
|
||||
+ } while (strm->avail_out == 0);
|
||||
+
|
||||
+ s->deflateParams_out_buffer = output;
|
||||
+ s->deflateParams_out_length = total_output;
|
||||
+
|
||||
+ return Z_OK;
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
+#ifndef SETP_BYTE
|
||||
+int
|
||||
+flushParams(di_stream* s)
|
||||
+{
|
||||
+ dTHX;
|
||||
+ int ret ;
|
||||
+ z_stream * strm = &s->stream;
|
||||
+
|
||||
+ strm->next_in = NULL;
|
||||
+ strm->avail_in = 0;
|
||||
+
|
||||
+ Bytef* output = s->deflateParams_out_buffer ;
|
||||
+ uLong total_output = s->deflateParams_out_length;
|
||||
+
|
||||
+ uLong have = 0;
|
||||
+
|
||||
+ do
|
||||
+ {
|
||||
+ if (output)
|
||||
+ output = (unsigned char *)saferealloc(output, total_output + s->bufsize);
|
||||
+ else
|
||||
+ output = (unsigned char *)safemalloc(s->bufsize);
|
||||
+
|
||||
+ strm->next_out = output + total_output;
|
||||
+ strm->avail_out = s->bufsize;
|
||||
+
|
||||
+ ret = deflateParams(&(s->stream), s->Level, s->Strategy);
|
||||
+ /* fprintf(stderr, "deflateParams %d %s %lu\n", ret,
|
||||
+ GetErrorString(ret), s->bufsize - strm->avail_out); */
|
||||
+
|
||||
+ if (ret == Z_STREAM_ERROR)
|
||||
+ break;
|
||||
+
|
||||
+ have = s->bufsize - strm->avail_out;
|
||||
+ total_output += have;
|
||||
+
|
||||
+
|
||||
+ } while (ret == Z_BUF_ERROR) ;
|
||||
+
|
||||
+ if(ret == Z_STREAM_ERROR)
|
||||
+ safefree(output);
|
||||
+ else
|
||||
+ {
|
||||
+ s->deflateParams_out_buffer = output;
|
||||
+ s->deflateParams_out_length = total_output;
|
||||
+ }
|
||||
+
|
||||
+ return ret;
|
||||
+}
|
||||
+#endif /* ! SETP_BYTE */
|
||||
|
||||
#include "constants.h"
|
||||
|
||||
@@ -991,20 +1093,24 @@ deflate (s, buf, output)
|
||||
/* Check for saved output from deflateParams */
|
||||
if (s->deflateParams_out_length) {
|
||||
uLong plen = s->deflateParams_out_length ;
|
||||
- /* printf("Copy %d bytes saved data\n", plen);*/
|
||||
+ /* printf("Copy %lu bytes saved data\n", plen); */
|
||||
if (s->stream.avail_out < plen) {
|
||||
- /*printf("GROW from %d to %d\n", s->stream.avail_out,
|
||||
- SvLEN(output) + plen - s->stream.avail_out); */
|
||||
- Sv_Grow(output, SvLEN(output) + plen - s->stream.avail_out) ;
|
||||
+ /* printf("GROW from %d to %lu\n", s->stream.avail_out,
|
||||
+ SvLEN(output) + plen - s->stream.avail_out); */
|
||||
+ s->stream.next_out = (Bytef*) Sv_Grow(output, SvLEN(output) + plen - s->stream.avail_out) ;
|
||||
+ s->stream.next_out += cur_length;
|
||||
}
|
||||
|
||||
- Copy(s->stream.next_out, s->deflateParams_out_buffer, plen, Bytef) ;
|
||||
- cur_length = cur_length + plen;
|
||||
+ Copy(s->deflateParams_out_buffer, s->stream.next_out, plen, Bytef) ;
|
||||
+ cur_length += plen;
|
||||
SvCUR_set(output, cur_length);
|
||||
- s->stream.next_out += plen ;
|
||||
- s->stream.avail_out = SvLEN(output) - cur_length ;
|
||||
- increment = s->stream.avail_out;
|
||||
- s->deflateParams_out_length = 0;
|
||||
+ s->stream.next_out += plen ;
|
||||
+ s->stream.avail_out = SvLEN(output) - cur_length ;
|
||||
+ increment = s->stream.avail_out;
|
||||
+
|
||||
+ s->deflateParams_out_length = 0;
|
||||
+ Safefree(s->deflateParams_out_buffer);
|
||||
+ s->deflateParams_out_buffer = NULL;
|
||||
}
|
||||
#endif
|
||||
RETVAL = Z_OK ;
|
||||
@@ -1027,6 +1133,12 @@ deflate (s, buf, output)
|
||||
}
|
||||
|
||||
RETVAL = deflate(&(s->stream), Z_NO_FLUSH);
|
||||
+ if (RETVAL != Z_STREAM_ERROR) {
|
||||
+ int done = increment - s->stream.avail_out ;
|
||||
+ /* printf("std DEFLATEr returned %d '%s' avail in %d, out %d wrote %d\n", RETVAL,
|
||||
+ GetErrorString(RETVAL), s->stream.avail_in,
|
||||
+s->stream.avail_out, done); */
|
||||
+ }
|
||||
|
||||
if (trace) {
|
||||
printf("DEFLATE returned %d %s, avail in %d, out %d\n", RETVAL,
|
||||
@@ -1080,7 +1192,6 @@ flush(s, output, f=Z_FINISH)
|
||||
CODE:
|
||||
bufinc = s->bufsize;
|
||||
|
||||
- s->stream.avail_in = 0; /* should be zero already anyway */
|
||||
|
||||
/* retrieve the output buffer */
|
||||
output = deRef_l(output, "flush") ;
|
||||
@@ -1108,20 +1219,24 @@ flush(s, output, f=Z_FINISH)
|
||||
/* Check for saved output from deflateParams */
|
||||
if (s->deflateParams_out_length) {
|
||||
uLong plen = s->deflateParams_out_length ;
|
||||
- /* printf("Copy %d bytes saved data\n", plen); */
|
||||
+ /* printf("Copy %lu bytes saved data\n", plen); */
|
||||
if (s->stream.avail_out < plen) {
|
||||
- /* printf("GROW from %d to %d\n", s->stream.avail_out,
|
||||
+ /* printf("GROW from %d to %lu\n", s->stream.avail_out,
|
||||
SvLEN(output) + plen - s->stream.avail_out); */
|
||||
- Sv_Grow(output, SvLEN(output) + plen - s->stream.avail_out) ;
|
||||
+ s->stream.next_out = (Bytef*) Sv_Grow(output, SvLEN(output) + plen - s->stream.avail_out) ;
|
||||
+ s->stream.next_out += cur_length;
|
||||
}
|
||||
|
||||
- Copy(s->stream.next_out, s->deflateParams_out_buffer, plen, Bytef) ;
|
||||
- cur_length = cur_length + plen;
|
||||
+ Copy(s->deflateParams_out_buffer, s->stream.next_out, plen, Bytef) ;
|
||||
+ cur_length += plen;
|
||||
SvCUR_set(output, cur_length);
|
||||
- s->stream.next_out += plen ;
|
||||
- s->stream.avail_out = SvLEN(output) - cur_length ;
|
||||
- increment = s->stream.avail_out;
|
||||
- s->deflateParams_out_length = 0;
|
||||
+ s->stream.next_out += plen ;
|
||||
+ s->stream.avail_out = SvLEN(output) - cur_length ;
|
||||
+ increment = s->stream.avail_out;
|
||||
+
|
||||
+ s->deflateParams_out_length = 0;
|
||||
+ Safefree(s->deflateParams_out_buffer);
|
||||
+ s->deflateParams_out_buffer = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -1145,9 +1260,15 @@ flush(s, output, f=Z_FINISH)
|
||||
}
|
||||
|
||||
RETVAL = deflate(&(s->stream), f);
|
||||
+ if (RETVAL != Z_STREAM_ERROR) {
|
||||
+ int done = availableout - s->stream.avail_out ;
|
||||
+ /* printf("flush DEFLATEr returned %d '%s' avail in %d, out %d wrote %d\n", RETVAL,
|
||||
+ GetErrorString(RETVAL), s->stream.avail_in,
|
||||
+s->stream.avail_out, done); */
|
||||
+ }
|
||||
|
||||
if (trace) {
|
||||
- printf("flush DEFLATE returned %d %s, avail in %d, out %d\n", RETVAL,
|
||||
+ printf("flush DEFLATE returned %d '%s', avail in %d, out %d\n", RETVAL,
|
||||
GetErrorString(RETVAL), s->stream.avail_in, s->stream.avail_out);
|
||||
DispStream(s, "AFTER");
|
||||
}
|
||||
@@ -1184,41 +1305,38 @@ _deflateParams(s, flags, level, strategy, bufsize)
|
||||
int level
|
||||
int strategy
|
||||
uLong bufsize
|
||||
+ bool changed = FALSE;
|
||||
CODE:
|
||||
- /* printf("_deflateParams(Flags %d Level %d Strategy %d Bufsize %d)\n", flags, level, strategy, bufsize);
|
||||
- printf("Before -- Level %d, Strategy %d, Bufsize %d\n", s->Level, s->Strategy, s->bufsize); */
|
||||
- if (flags & 1)
|
||||
- s->Level = level ;
|
||||
- if (flags & 2)
|
||||
- s->Strategy = strategy ;
|
||||
- if (flags & 4) {
|
||||
+ /* printf("_deflateParams(Flags %d Level %d Strategy %d Bufsize %d)\n", flags, level, strategy, bufsize);
|
||||
+ printf("Before -- Level %d, Strategy %d, Bufsize %d\n", s->Level, s->Strategy, s->bufsize); */
|
||||
+ if (flags & 1 && level != s->Level) {
|
||||
+ s->Level = level ;
|
||||
+ changed = TRUE;
|
||||
+ }
|
||||
+ if (flags & 2 && strategy != s->Strategy) {
|
||||
+ s->Strategy = strategy ;
|
||||
+ changed = TRUE;
|
||||
+ }
|
||||
+ if (flags & 4)
|
||||
s->bufsize = bufsize;
|
||||
- }
|
||||
- /* printf("After -- Level %d, Strategy %d, Bufsize %d\n", s->Level, s->Strategy, s->bufsize);*/
|
||||
+ if (changed) {
|
||||
#ifdef SETP_BYTE
|
||||
- s->stream.avail_in = 0;
|
||||
- s->stream.next_out = &(s->deflateParams_out_byte) ;
|
||||
- s->stream.avail_out = 1;
|
||||
- RETVAL = deflateParams(&(s->stream), s->Level, s->Strategy);
|
||||
- s->deflateParams_out_valid =
|
||||
- (RETVAL == Z_OK && s->stream.avail_out == 0) ;
|
||||
- /* printf("RETVAL %d, avail out %d, byte %c\n", RETVAL, s->stream.avail_out, s->deflateParams_out_byte); */
|
||||
+ s->stream.avail_in = 0;
|
||||
+ s->stream.next_out = &(s->deflateParams_out_byte) ;
|
||||
+ s->stream.avail_out = 1;
|
||||
+ RETVAL = deflateParams(&(s->stream), s->Level, s->Strategy);
|
||||
+ s->deflateParams_out_valid =
|
||||
+ (RETVAL == Z_OK && s->stream.avail_out == 0) ;
|
||||
#else
|
||||
- /* printf("Level %d Strategy %d, Prev Len %d\n",
|
||||
+ /* printf("Level %d Strategy %d, Prev Len %d\n",
|
||||
s->Level, s->Strategy, s->deflateParams_out_length); */
|
||||
- s->stream.avail_in = 0;
|
||||
- if (s->deflateParams_out_buffer == NULL)
|
||||
- s->deflateParams_out_buffer = safemalloc(deflateParams_BUFFER_SIZE);
|
||||
- s->stream.next_out = s->deflateParams_out_buffer ;
|
||||
- s->stream.avail_out = deflateParams_BUFFER_SIZE;
|
||||
-
|
||||
- RETVAL = deflateParams(&(s->stream), s->Level, s->Strategy);
|
||||
- s->deflateParams_out_length = deflateParams_BUFFER_SIZE - s->stream.avail_out;
|
||||
- /* printf("RETVAL %d, length out %d, avail %d\n",
|
||||
- RETVAL, s->deflateParams_out_length, s->stream.avail_out ); */
|
||||
+ RETVAL = flushParams(s);
|
||||
#endif
|
||||
+ }
|
||||
+ else
|
||||
+ RETVAL = Z_OK;
|
||||
OUTPUT:
|
||||
- RETVAL
|
||||
+ RETVAL
|
||||
|
||||
|
||||
int
|
||||
diff --git a/t/02zlib.t b/t/02zlib.t
|
||||
index 2c9aad6..5d024a9 100644
|
||||
--- a/t/02zlib.t
|
||||
+++ b/t/02zlib.t
|
||||
@@ -27,7 +27,7 @@ BEGIN
|
||||
$count = 232 ;
|
||||
}
|
||||
elsif ($] >= 5.006) {
|
||||
- $count = 317 ;
|
||||
+ $count = 320 ;
|
||||
}
|
||||
else {
|
||||
$count = 275 ;
|
||||
@@ -559,6 +559,13 @@ SKIP:
|
||||
is $x->get_Level(), Z_BEST_SPEED;
|
||||
is $x->get_Strategy(), Z_HUFFMAN_ONLY;
|
||||
|
||||
+ # change both Level & Strategy again without any calls to deflate
|
||||
+ $status = $x->deflateParams(-Level => Z_DEFAULT_COMPRESSION, -Strategy => Z_DEFAULT_STRATEGY, -Bufsize => 1234) ;
|
||||
+ cmp_ok $status, '==', Z_OK ;
|
||||
+
|
||||
+ is $x->get_Level(), Z_DEFAULT_COMPRESSION;
|
||||
+ is $x->get_Strategy(), Z_DEFAULT_STRATEGY;
|
||||
+
|
||||
$status = $x->deflate($goodbye, $Answer) ;
|
||||
cmp_ok $status, '==', Z_OK ;
|
||||
$input .= $goodbye;
|
||||
@@ -568,7 +575,7 @@ SKIP:
|
||||
cmp_ok $status, '==', Z_OK ;
|
||||
|
||||
is $x->get_Level(), Z_NO_COMPRESSION;
|
||||
- is $x->get_Strategy(), Z_HUFFMAN_ONLY;
|
||||
+ is $x->get_Strategy(), Z_DEFAULT_STRATEGY;
|
||||
|
||||
$status = $x->deflate($goodbye, $Answer) ;
|
||||
cmp_ok $status, '==', Z_OK ;
|
||||
--
|
||||
2.7.4
|
||||
|
82
Compress-Raw-Zlib-2.071-Conform-to-C90.patch
Normal file
82
Compress-Raw-Zlib-2.071-Conform-to-C90.patch
Normal file
@ -0,0 +1,82 @@
|
||||
From 1f3ac68dac93b7b85f09427d188386aaff0d3f80 Mon Sep 17 00:00:00 2001
|
||||
From: Reini Urban <reini.urban@gmail.com>
|
||||
Date: Fri, 17 Feb 2017 12:06:27 +0100
|
||||
Subject: [PATCH] Conform to C90
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
The code failed to compile when building perl because perl adds -Werror=declaration-after-statement:
|
||||
|
||||
gcc -c -I/usr/include -D_REENTRANT -D_GNU_SOURCE -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fwrapv -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Werror=declaration-after-statement -Wextra -Wc++-compat -Wwrite-strings -g -DVERSION=\"2.069\" -DXS_VERSION=\"2.069\" -fPIC "-I../.." -DNO_VIZ -DZ_SOLO -DGZIP_OS_CODE=3 Zlib.c
|
||||
Zlib.xs: In function 'flushParams':
|
||||
Zlib.xs:702:5: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
|
||||
Bytef* output = s->deflateParams_out_buffer ;
|
||||
^~~~~
|
||||
|
||||
CPAN RT#120272
|
||||
|
||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||
---
|
||||
Zlib.xs | 22 +++++++++++-----------
|
||||
1 file changed, 11 insertions(+), 11 deletions(-)
|
||||
|
||||
diff --git a/Zlib.xs b/Zlib.xs
|
||||
index 83d1423..7f4396a 100644
|
||||
--- a/Zlib.xs
|
||||
+++ b/Zlib.xs
|
||||
@@ -696,14 +696,14 @@ flushParams(di_stream* s)
|
||||
int ret ;
|
||||
z_stream * strm = &s->stream;
|
||||
|
||||
- strm->next_in = NULL;
|
||||
- strm->avail_in = 0;
|
||||
-
|
||||
Bytef* output = s->deflateParams_out_buffer ;
|
||||
uLong total_output = s->deflateParams_out_length;
|
||||
|
||||
uLong have = 0;
|
||||
|
||||
+ strm->next_in = NULL;
|
||||
+ strm->avail_in = 0;
|
||||
+
|
||||
do
|
||||
{
|
||||
if (output)
|
||||
@@ -1133,12 +1133,12 @@ deflate (s, buf, output)
|
||||
}
|
||||
|
||||
RETVAL = deflate(&(s->stream), Z_NO_FLUSH);
|
||||
- if (RETVAL != Z_STREAM_ERROR) {
|
||||
+ /* if (RETVAL != Z_STREAM_ERROR) {
|
||||
int done = increment - s->stream.avail_out ;
|
||||
- /* printf("std DEFLATEr returned %d '%s' avail in %d, out %d wrote %d\n", RETVAL,
|
||||
+ printf("std DEFLATEr returned %d '%s' avail in %d, out %d wrote %d\n", RETVAL,
|
||||
GetErrorString(RETVAL), s->stream.avail_in,
|
||||
-s->stream.avail_out, done); */
|
||||
- }
|
||||
+s->stream.avail_out, done);
|
||||
+ } */
|
||||
|
||||
if (trace) {
|
||||
printf("DEFLATE returned %d %s, avail in %d, out %d\n", RETVAL,
|
||||
@@ -1260,12 +1260,12 @@ flush(s, output, f=Z_FINISH)
|
||||
}
|
||||
|
||||
RETVAL = deflate(&(s->stream), f);
|
||||
- if (RETVAL != Z_STREAM_ERROR) {
|
||||
+ /* if (RETVAL != Z_STREAM_ERROR) {
|
||||
int done = availableout - s->stream.avail_out ;
|
||||
- /* printf("flush DEFLATEr returned %d '%s' avail in %d, out %d wrote %d\n", RETVAL,
|
||||
+ printf("flush DEFLATEr returned %d '%s' avail in %d, out %d wrote %d\n", RETVAL,
|
||||
GetErrorString(RETVAL), s->stream.avail_in,
|
||||
-s->stream.avail_out, done); */
|
||||
- }
|
||||
+s->stream.avail_out, done);
|
||||
+ } */
|
||||
|
||||
if (trace) {
|
||||
printf("flush DEFLATE returned %d '%s', avail in %d, out %d\n", RETVAL,
|
||||
--
|
||||
2.7.4
|
||||
|
@ -1,95 +0,0 @@
|
||||
From a30130055928e5979c35aceee75cc3becfe3ad22 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
||||
Date: Tue, 7 Feb 2017 17:23:29 +0100
|
||||
Subject: [PATCH] Adapt tests to zlib 1.2.11
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
CPAN RT#120134
|
||||
|
||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||
---
|
||||
t/cz-03zlib-v1.t | 13 +++++++++++--
|
||||
t/cz-06gzsetp.t | 4 +++-
|
||||
2 files changed, 14 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/t/cz-03zlib-v1.t b/t/cz-03zlib-v1.t
|
||||
index a85ed10..e070d46 100755
|
||||
--- a/t/cz-03zlib-v1.t
|
||||
+++ b/t/cz-03zlib-v1.t
|
||||
@@ -23,10 +23,10 @@ BEGIN
|
||||
|
||||
my $count = 0 ;
|
||||
if ($] < 5.005) {
|
||||
- $count = 453 ;
|
||||
+ $count = 456 ;
|
||||
}
|
||||
else {
|
||||
- $count = 471 ;
|
||||
+ $count = 474 ;
|
||||
}
|
||||
|
||||
|
||||
@@ -721,6 +721,9 @@ EOM
|
||||
|
||||
($Answer, $status) = $x->deflate($hello) ;
|
||||
ok $status == Z_OK ;
|
||||
+ ($X, $status) = $x->flush(Z_BLOCK) ;
|
||||
+ ok $status == Z_OK ;
|
||||
+ $Answer .= $X ;
|
||||
$input .= $hello;
|
||||
|
||||
# error cases
|
||||
@@ -747,6 +750,9 @@ EOM
|
||||
($X, $status) = $x->deflate($goodbye) ;
|
||||
ok $status == Z_OK ;
|
||||
$Answer .= $X ;
|
||||
+ ($X, $status) = $x->flush(Z_BLOCK) ;
|
||||
+ ok $status == Z_OK ;
|
||||
+ $Answer .= $X ;
|
||||
$input .= $goodbye;
|
||||
|
||||
# change only Level
|
||||
@@ -759,6 +765,9 @@ EOM
|
||||
($X, $status) = $x->deflate($goodbye) ;
|
||||
ok $status == Z_OK ;
|
||||
$Answer .= $X ;
|
||||
+ ($X, $status) = $x->flush(Z_BLOCK) ;
|
||||
+ ok $status == Z_OK ;
|
||||
+ $Answer .= $X ;
|
||||
$input .= $goodbye;
|
||||
|
||||
# change only Strategy
|
||||
diff --git a/t/cz-06gzsetp.t b/t/cz-06gzsetp.t
|
||||
index b2cc687..45869a0 100644
|
||||
--- a/t/cz-06gzsetp.t
|
||||
+++ b/t/cz-06gzsetp.t
|
||||
@@ -39,7 +39,7 @@ my $ver = Compress::Zlib::zlib_version();
|
||||
plan skip_all => "gzsetparams needs zlib 1.0.6 or better. You have $ver\n"
|
||||
if ZLIB_VERNUM() < 0x1060 ;
|
||||
|
||||
-plan tests => 51 + $extra ;
|
||||
+plan tests => 55 + $extra ;
|
||||
|
||||
# Check zlib_version and ZLIB_VERSION are the same.
|
||||
SKIP: {
|
||||
@@ -65,6 +65,7 @@ SKIP: {
|
||||
|
||||
$input .= $hello;
|
||||
is $x->gzwrite($hello), $len_hello, "gzwrite returned $len_hello" ;
|
||||
+ cmp_ok $x->gzflush(Z_BLOCK), '==', Z_OK, "flush before gzsetparams is ok";
|
||||
|
||||
# Error cases
|
||||
eval { $x->gzsetparams() };
|
||||
@@ -120,6 +121,7 @@ foreach my $CompressClass ('IO::Compress::Gzip',
|
||||
|
||||
my $input .= $hello;
|
||||
is $x->write($hello), $len_hello, "wrote $len_hello bytes" ;
|
||||
+ ok $x->flush(Z_BLOCK), "flush before deflateParams is ok";
|
||||
|
||||
# Change both Level & Strategy
|
||||
ok $x->deflateParams(Z_BEST_SPEED, Z_HUFFMAN_ONLY), "deflateParams ok";
|
||||
--
|
||||
2.7.4
|
||||
|
19
perl.spec
19
perl.spec
@ -28,7 +28,7 @@
|
||||
Name: perl
|
||||
Version: %{perl_version}
|
||||
# release number must be even higher, because dual-lived modules will be broken otherwise
|
||||
Release: 388%{?dist}
|
||||
Release: 389%{?dist}
|
||||
Epoch: %{perl_epoch}
|
||||
Summary: Practical Extraction and Report Language
|
||||
Group: Development/Languages
|
||||
@ -272,10 +272,11 @@ Patch75: perl-5.24.1-permit-goto-at-top-level-of-multicalled-sub.patch
|
||||
# Fix a heap overlow in parsing $#, RT#129274, in upstream after 5.25.9
|
||||
Patch76: perl-5.24.1-perl-129274-avoid-treating-the-in-as-a-comment-intro.patch
|
||||
|
||||
# Adapt tests to zlib-1.2.11, bug #1420326, CPAN RT#119762,
|
||||
# should be removed after fixing Compress-Raw-Zlib properly
|
||||
Patch77: Compress-Raw-Zlib-2.071-Adapt-tests-to-zlib-1.2.11.patch
|
||||
Patch78: IO-Compress-2.070-Adapt-tests-to-zlib-1.2.11.patch
|
||||
# 1/2 Adapt to zlib-1.2.11, bug #1420326, CPAN RT#119762,
|
||||
# in upstream Compress-Raw-Zlib-2.072
|
||||
Patch77: Compress-Raw-Zlib-2.071-Adapt-to-zlib-1.2.11.patch
|
||||
# 2/2 Fix compiler fatal warnings in Compress-Raw-Zlib, CPAN RT#120272
|
||||
Patch78: Compress-Raw-Zlib-2.071-Conform-to-C90.patch
|
||||
|
||||
# Fix a crash when compiling a regexp with impossible quantifiers, RT#130561,
|
||||
# in upstream after 5.25.9
|
||||
@ -2994,8 +2995,6 @@ Perl extension for Version Objects
|
||||
%patch76 -p1
|
||||
pushd cpan/Compress-Raw-Zlib
|
||||
%patch77 -p1
|
||||
popd
|
||||
pushd cpan/IO-Compress
|
||||
%patch78 -p1
|
||||
popd
|
||||
%patch79 -p1
|
||||
@ -3068,7 +3067,8 @@ perl -x patchlevel.h \
|
||||
'Fedora Patch74: Fix a memory leak in B::RHE->HASH method (RT#130504)' \
|
||||
'Fedora Patch75: Fix parsing goto statements in multicalled subroutine (RT#113938)' \
|
||||
'Fedora Patch76: Fix a heap overlow in parsing $# (RT#129274)' \
|
||||
'Fedora Patch77: Adapt tests to zlib-1.2.11 (CPAN RT#119762)' \
|
||||
'Fedora Patch77: Adapt to zlib-1.2.11 (CPAN RT#119762)' \
|
||||
'Fedora Patch78: Fix compiler fatal warnings in Compress-Raw-Zlib (CPAN RT#120272)' \
|
||||
'Fedora Patch79: Fix a crash when compiling a regexp with impossible quantifiers (RT#130561)' \
|
||||
'Fedora Patch82: Fix a buffer overrun with format and "use bytes" (RT#130703)' \
|
||||
'Fedora Patch83: Fix a buffer overflow when studying some regexps repeatedly (RT#129281, RT#129061)' \
|
||||
@ -5348,6 +5348,9 @@ popd
|
||||
|
||||
# Old changelog entries are preserved in CVS.
|
||||
%changelog
|
||||
* Fri Feb 17 2017 Petr Pisar <ppisar@redhat.com> - 4:5.24.1-389
|
||||
- Adapt Compress::Raw::Zlib to zlib-1.2.11 (bug #1420326)
|
||||
|
||||
* Fri Feb 10 2017 Petr Pisar <ppisar@redhat.com> - 4:5.24.1-388
|
||||
- Adapt tests to zlib-1.2.11 (bug #1420326)
|
||||
- Fix a crash when compiling a regexp with impossible quantifiers (RT#130561)
|
||||
|
Loading…
Reference in New Issue
Block a user