Skip to content

Commit 80b24a9

Browse files
committed
- Issue python#29169: Update zlib to 1.2.11.
1 parent 60a1b35 commit 80b24a9

File tree

11 files changed

+34
-28
lines changed

11 files changed

+34
-28
lines changed

Misc/NEWS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Core and Builtins
1818
Extension Modules
1919
-----------------
2020

21-
- Issue #29169: Update zlib to 1.2.10.
21+
- Issue #29169: Update zlib to 1.2.11.
2222

2323
Library
2424
-------

Modules/zlib/README

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ZLIB DATA COMPRESSION LIBRARY
22

3-
zlib 1.2.10 is a general purpose data compression library. All the code is
3+
zlib 1.2.11 is a general purpose data compression library. All the code is
44
thread safe. The data format used by the zlib library is described by RFCs
55
(Request for Comments) 1950 to 1952 in the files
66
http://tools.ietf.org/html/rfc1950 (zlib format), rfc1951 (deflate format) and
@@ -31,7 +31,7 @@ Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
3131
issue of Dr. Dobb's Journal; a copy of the article is available at
3232
http://marknelson.us/1997/01/01/zlib-engine/ .
3333

34-
The changes made in version 1.2.10 are documented in the file ChangeLog.
34+
The changes made in version 1.2.11 are documented in the file ChangeLog.
3535

3636
Unsupported third party contributions are provided in directory contrib/ .
3737

Modules/zlib/deflate.c

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
#include "deflate.h"
5353

5454
const char deflate_copyright[] =
55-
" deflate 1.2.10 Copyright 1995-2017 Jean-loup Gailly and Mark Adler ";
55+
" deflate 1.2.11 Copyright 1995-2017 Jean-loup Gailly and Mark Adler ";
5656
/*
5757
If you use the zlib library in a product, an acknowledgment is welcome
5858
in the documentation of your product. If for some reason you cannot
@@ -586,7 +586,8 @@ int ZEXPORT deflateParams(strm, level, strategy)
586586
}
587587
func = configuration_table[s->level].func;
588588

589-
if ((strategy != s->strategy || func != configuration_table[level].func)) {
589+
if ((strategy != s->strategy || func != configuration_table[level].func) &&
590+
s->high_water) {
590591
/* Flush the last buffer: */
591592
int err = deflate(strm, Z_BLOCK);
592593
if (err == Z_STREAM_ERROR)
@@ -1671,8 +1672,6 @@ local block_state deflate_stored(s, flush)
16711672
len = left + s->strm->avail_in; /* limit len to the input */
16721673
if (len > have)
16731674
len = have; /* limit len to the output */
1674-
if (left > len)
1675-
left = len; /* limit window pull to len */
16761675

16771676
/* If the stored block would be less than min_block in length, or if
16781677
* unable to copy all of the available input when flushing, then try
@@ -1681,13 +1680,13 @@ local block_state deflate_stored(s, flush)
16811680
*/
16821681
if (len < min_block && ((len == 0 && flush != Z_FINISH) ||
16831682
flush == Z_NO_FLUSH ||
1684-
len - left != s->strm->avail_in))
1683+
len != left + s->strm->avail_in))
16851684
break;
16861685

16871686
/* Make a dummy stored block in pending to get the header bytes,
16881687
* including any pending bits. This also updates the debugging counts.
16891688
*/
1690-
last = flush == Z_FINISH && len - left == s->strm->avail_in ? 1 : 0;
1689+
last = flush == Z_FINISH && len == left + s->strm->avail_in ? 1 : 0;
16911690
_tr_stored_block(s, (char *)0, 0L, last);
16921691

16931692
/* Replace the lengths in the dummy stored block with len. */
@@ -1699,14 +1698,16 @@ local block_state deflate_stored(s, flush)
16991698
/* Write the stored block header bytes. */
17001699
flush_pending(s->strm);
17011700

1702-
/* Update debugging counts for the data about to be copied. */
17031701
#ifdef ZLIB_DEBUG
1702+
/* Update debugging counts for the data about to be copied. */
17041703
s->compressed_len += len << 3;
17051704
s->bits_sent += len << 3;
17061705
#endif
17071706

17081707
/* Copy uncompressed bytes from the window to next_out. */
17091708
if (left) {
1709+
if (left > len)
1710+
left = len;
17101711
zmemcpy(s->strm->next_out, s->window + s->block_start, left);
17111712
s->strm->next_out += left;
17121713
s->strm->avail_out -= left;
@@ -1756,6 +1757,8 @@ local block_state deflate_stored(s, flush)
17561757
s->block_start = s->strstart;
17571758
s->insert += MIN(used, s->w_size - s->insert);
17581759
}
1760+
if (s->high_water < s->strstart)
1761+
s->high_water = s->strstart;
17591762

17601763
/* If the last block was written to next_out, then done. */
17611764
if (last)
@@ -1783,6 +1786,8 @@ local block_state deflate_stored(s, flush)
17831786
read_buf(s->strm, s->window + s->strstart, have);
17841787
s->strstart += have;
17851788
}
1789+
if (s->high_water < s->strstart)
1790+
s->high_water = s->strstart;
17861791

17871792
/* There was not enough avail_out to write a complete worthy or flushed
17881793
* stored block to next_out. Write a stored block to pending instead, if we

Modules/zlib/gzlib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* gzlib.c -- zlib functions common to reading and writing gzip files
2-
* Copyright (C) 2004, 2010, 2011, 2012, 2013, 2016 Mark Adler
2+
* Copyright (C) 2004-2017 Mark Adler
33
* For conditions of distribution and use, see copyright notice in zlib.h
44
*/
55

Modules/zlib/gzwrite.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* gzwrite.c -- zlib functions for writing gzip files
2-
* Copyright (C) 2004, 2005, 2010, 2011, 2012, 2013, 2016 Mark Adler
2+
* Copyright (C) 2004-2017 Mark Adler
33
* For conditions of distribution and use, see copyright notice in zlib.h
44
*/
55

Modules/zlib/inffast.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* inffast.c -- fast decoding
2-
* Copyright (C) 1995-2008, 2010, 2013, 2016 Mark Adler
2+
* Copyright (C) 1995-2017 Mark Adler
33
* For conditions of distribution and use, see copyright notice in zlib.h
44
*/
55

Modules/zlib/inftrees.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#define MAXBITS 15
1010

1111
const char inflate_copyright[] =
12-
" inflate 1.2.10 Copyright 1995-2017 Mark Adler ";
12+
" inflate 1.2.11 Copyright 1995-2017 Mark Adler ";
1313
/*
1414
If you use the zlib library in a product, an acknowledgment is welcome
1515
in the documentation of your product. If for some reason you cannot
@@ -62,7 +62,7 @@ unsigned short FAR *work;
6262
35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0};
6363
static const unsigned short lext[31] = { /* Length codes 257..285 extra */
6464
16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18,
65-
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 192, 202};
65+
19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 77, 202};
6666
static const unsigned short dbase[32] = { /* Distance codes 0..29 base */
6767
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193,
6868
257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145,

Modules/zlib/trees.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* trees.c -- output deflated data using Huffman coding
2-
* Copyright (C) 1995-2016 Jean-loup Gailly
2+
* Copyright (C) 1995-2017 Jean-loup Gailly
33
* detect_data_type() function provided freely by Cosmin Truta, 2006
44
* For conditions of distribution and use, see copyright notice in zlib.h
55
*/
@@ -906,7 +906,7 @@ void ZLIB_INTERNAL _tr_align(s)
906906

907907
/* ===========================================================================
908908
* Determine the best encoding for the current block: dynamic trees, static
909-
* trees or store, and output the encoded block to the zip file.
909+
* trees or store, and write out the encoded block.
910910
*/
911911
void ZLIB_INTERNAL _tr_flush_block(s, buf, stored_len, last)
912912
deflate_state *s;

Modules/zlib/zlib.3

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.TH ZLIB 3 "2 Jan 2017"
1+
.TH ZLIB 3 "15 Jan 2017"
22
.SH NAME
33
zlib \- compression/decompression library
44
.SH SYNOPSIS
@@ -105,7 +105,7 @@ before asking for help.
105105
Send questions and/or comments to zlib@gzip.org,
106106
or (for the Windows DLL version) to Gilles Vollant (info@winimage.com).
107107
.SH AUTHORS AND LICENSE
108-
Version 1.2.10
108+
Version 1.2.11
109109
.LP
110110
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
111111
.LP

Modules/zlib/zlib.h

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* zlib.h -- interface of the 'zlib' general purpose compression library
2-
version 1.2.10, January 2nd, 2017
2+
version 1.2.11, January 15th, 2017
33
44
Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
55
@@ -37,11 +37,11 @@
3737
extern "C" {
3838
#endif
3939

40-
#define ZLIB_VERSION "1.2.10"
41-
#define ZLIB_VERNUM 0x12a0
40+
#define ZLIB_VERSION "1.2.11"
41+
#define ZLIB_VERNUM 0x12b0
4242
#define ZLIB_VER_MAJOR 1
4343
#define ZLIB_VER_MINOR 2
44-
#define ZLIB_VER_REVISION 10
44+
#define ZLIB_VER_REVISION 11
4545
#define ZLIB_VER_SUBREVISION 0
4646

4747
/*
@@ -712,10 +712,11 @@ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm,
712712
used to switch between compression and straight copy of the input data, or
713713
to switch to a different kind of input data requiring a different strategy.
714714
If the compression approach (which is a function of the level) or the
715-
strategy is changed, then the input available so far is compressed with the
716-
old level and strategy using deflate(strm, Z_BLOCK). There are three
717-
approaches for the compression levels 0, 1..3, and 4..9 respectively. The
718-
new level and strategy will take effect at the next call of deflate().
715+
strategy is changed, and if any input has been consumed in a previous
716+
deflate() call, then the input available so far is compressed with the old
717+
level and strategy using deflate(strm, Z_BLOCK). There are three approaches
718+
for the compression levels 0, 1..3, and 4..9 respectively. The new level
719+
and strategy will take effect at the next call of deflate().
719720
720721
If a deflate(strm, Z_BLOCK) is performed by deflateParams(), and it does
721722
not have enough output space to complete, then the parameter change will not

0 commit comments

Comments
 (0)