192 Commits

Author SHA1 Message Date
Mark Adler
fd366384cf Prevent the use of insecure functions without an explicit request.
ZLIB_INSECURE must be defined in order to compile code that uses
the insecure functions vsprintf() or sprintf(). This would occur
only if the standard vsnprintf() or snprintf() functions are not
available. Providing the --insecure option to ./configure will
define ZLIB_INSECURE. A flag is added to zlibCompileFlags() to
indicate that gzprintf() is not implemented due to the need for
the use of an insecure function, but ZLIB_INSECURE was not
defined.
2026-01-05 15:03:04 -06:00
Mark Adler
ba829a4585 Check for negative lengths in crc32_combine functions.
Though zlib.h says that len2 must be non-negative, this avoids the
possibility of an accidental infinite loop.
2026-01-05 15:03:04 -06:00
Mark Adler
570720b0c2 zlib 1.3.1.2
Interim version for an audit.
2025-12-08 05:30:18 -08:00
Mark Adler
81cc0bebed Support non-blocking devices in the gz* routines. 2025-12-08 03:52:25 -08:00
Mark Adler
370ef1b41f Return all available uncompressed data on error in gzread.c.
The error is recorded, and will be detected by the application
after all of the uncompressed data has been consumed and then one
more call is made to read data. The error is available immediately
from gzerror() if the application would like to know earlier.
2025-12-06 19:56:13 -08:00
Mark Adler
9702c9d64e Update links to the RFCs. 2025-12-06 17:39:45 -08:00
Mark Adler
3e8e4bb5b2 Clarify the use of inflateGetHeader(). 2025-12-06 17:39:45 -08:00
Mark Adler
1ab1026a20 Add a "G" option to force gzip, disabling transparency in gzread().
If the input is not a gzip stream with this option, an error will
be returned.
2025-12-06 17:39:14 -08:00
Mark Adler
473f78532a Fix bug in inflatePrime() for 16-bit ints.
Also elaborate on the inflatePrime() error return in zlib.h, and
assure that data_type is correct after initialization and a
Z_NEED_DICT return.
2025-05-13 18:00:03 -07:00
Mark Adler
a9bb8c48d7 Note the use of gzungetc() to run a deferred seek while reading. 2025-05-13 18:00:03 -07:00
Mark Adler
aaf94f387d Note that gzseek() requests are deferred until the next operation. 2025-05-13 18:00:03 -07:00
Mark Adler
aeab3f6cc7 Clarify the use of errnum in gzerror(). 2025-02-25 00:31:37 -08:00
Mark Adler
4d1c7207ff Remove some unsightly spaces in zlib.h. 2025-02-21 13:53:05 -08:00
Vollstrecker
5a82f71ed1 Use generated zconf.h in cmake build.
This restores the inclusion of the local zconf.h (double quoted)
in normal usage.
2025-02-18 15:00:15 -08:00
Vollstrecker
00161eff1d Do not look for zconf.h in the source directory.
Temporary patch for cmake, but too violent. A better solution will
need to be found.
2025-02-13 11:51:26 -08:00
Mark Adler
e011d8c164 Add deflateUsed() function to get the used bits in the last byte.
This returns the number of used bits in the last byte of a stream
that has just been compressed with deflate.
2024-07-01 19:34:40 -05:00
Mark Adler
0f3b7b9595 Correct typo in zlib.h comment. 2024-05-16 19:07:00 -07:00
Mark Adler
5c42a230b7 Correct argument types for 64-bit combine functions. 2024-02-11 15:42:08 -08:00
Mark Adler
96d3e9e3dd Expand on the deflate strategy parameter in zlib.h. 2024-02-07 10:48:55 -08:00
Mark Adler
9f0f2d4f9f Change version number on develop branch to 1.3.1.1. 2024-01-22 13:07:41 -08:00
Mark Adler
51b7f2abda zlib 1.3.1 2024-01-22 10:32:37 -08:00
Mark Adler
36e369e1a5 Note that the len2 argument of crc_combine*() must be non-negative.
If it is negative, then the code will enter an infinite loop.
2024-01-13 22:30:30 -08:00
Paul Ivanov
643e17b749 Correct repeated words in source file comments and a readme. 2023-11-14 18:44:32 -08:00
Mark Adler
3a98b57e55 Change version number on develop branch to 1.3.0.1. 2023-08-18 13:23:07 -07:00
Mark Adler
09155eaa2f zlib 1.3 2023-08-18 01:45:36 -07:00
Mark Adler
22fc20898b Clarify requirement in zlib.h to avoid multiple flush markers. 2023-08-17 17:11:11 -07:00
Mark Adler
a88f727dbe Document in zlib.h the initialization of stream fields by the Init
and Reset functions.
2023-07-10 11:27:50 -07:00
Mark Adler
263a982866 Correct comment in zlib.h on os setting in gzip header.
The comment said that the os is set to 255, when in fact it has
been set to the current os since zlib 1.2.3. Or at least our best
guess at the os made at compile time.
2023-05-16 20:28:59 -07:00
Paul Marquess
48c3741002 Remove duplicate "the" in zlib.h. 2023-05-01 14:06:43 -07:00
Mark Adler
e9d5486e66 Remove K&R function definitions from zlib.
C2X has removed K&R definitions from the C function syntax.
Though the standard has not yet been approved, some high-profile
compilers are now issuing warnings when such definitions are
encountered.
2023-04-15 21:17:31 -07:00
Mark Adler
41fda48fc2 Change version number on develop branch to 1.2.13.1. 2022-10-15 09:02:21 -07:00
Mark Adler
04f42ceca4 zlib 1.2.13 2022-10-12 22:06:55 -07:00
Mark Adler
84c6716a48 Minor formatting improvements.
No code changes.
2022-10-05 15:17:52 -07:00
Mark Adler
5752b171fd Fix some typos.
No code changes.
2022-08-23 15:35:13 -07:00
Mark Adler
a4c17581d8 Change version number on develop branch to 1.2.12.1. 2022-03-27 18:07:49 -07:00
Mark Adler
21767c654d zlib 1.2.12 2022-03-27 16:05:02 -07:00
Mark Adler
e54494e6bc Clarify gz* function interfaces, referring to parameter names. 2020-08-31 12:53:58 -07:00
Mark Adler
0e96d8e7c7 Explicitly note that the 32-bit check values are 32 bits. 2019-04-05 15:27:47 -07:00
Mark Adler
f8719f5ae5 Speed up software CRC-32 computation by a factor of 1.5 to 3.
Use the interleaved method of Kadatch and Jenkins in order to make
use of pipelined instructions through multiple ALUs in a single
core. This also speeds up and simplifies the combination of CRCs,
and updates the functions to pre-calculate and use an operator for
CRC combination.
2018-12-26 12:26:52 -08:00
Mark Adler
41d86c73b2 Add crc32_combine_gen() and crc32_combine_op() for fast combines.
When the same len2 is used repeatedly, it is faster to use
crc32_combine_gen() to generate an operator, that is then used to
combine CRCs with crc32_combine_op().
2018-11-04 10:31:46 -08:00
Mark Adler
e99813dbfe Correct the initialization requirements for deflateInit2(). 2018-01-31 13:24:12 -08:00
Mark Adler
bf88202e31 Emphasize the need to continue decompressing gzip members. 2018-01-08 18:16:05 -08:00
Mark Adler
a577351394 Make the names in functions declarations identical to definitions. 2017-10-12 20:03:51 -07:00
Mark Adler
f9694097dd Permit a deflateParams() parameter change as soon as possible.
This commit 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.
2017-02-15 22:38:55 -08:00
Mark Adler
5ff989033e Cygwin does not have _wopen(), so do not create gzopen_w() there. 2017-01-16 09:38:36 -08:00
Mark Adler
7d60b86782 Change version number to 1.2.11.1. 2017-01-15 22:46:03 -08:00
Mark Adler
cacf7f1d4e zlib 1.2.11 2017-01-15 09:29:40 -08:00
Mark Adler
cbbd20302c Permit immediate deflateParams changes before any deflate input.
This permits deflateParams to change the strategy and level right
after deflateInit, without having to wait until a header has been
written. The parameters can be changed immediately up until the
first deflate call that consumes any input data.
2017-01-15 09:29:40 -08:00
Mark Adler
11ceaed751 Change version number to 1.2.10.1. 2017-01-15 09:07:08 -08:00
Mark Adler
4a090adef8 zlib 1.2.10 2017-01-02 18:21:29 -08:00