Log

Author Commit Date CI Message
Mark Adler ca50ebd4 2016-12-03T10:27:14 Create z_size_t and z_ssize_t types. Normally these are set to size_t and ssize_t. But if they do not exist, then they are set to the smallest integer type that can contain a pointer. size_t is unsigned and ssize_t is signed.
Mark Adler c5ee34c2 2016-12-03T08:29:57 Don't need to emit an empty fixed block when changing parameters. gzsetparams() was using Z_PARTIAL_FLUSH when it could use Z_BLOCK instead. This commit uses Z_BLOCK, which avoids emitting an unnecessary ten bits into the stream.
Mark Adler 9dc5a858 2016-11-05T08:43:29 Speed up deflation for level 0 (storing). The previous code slid the window and the hash table and copied every input byte three times in order to just write the data as stored blocks with no compression. This commit minimizes sliding and copying, especially for large input and output buffers. Level 0 compression is now more than 20 times faster than before the commit. Most of the speedup is due to deferring hash table slides until deflateParams() is called to change the compression level away from 0. More speedup is due to copying directly from next_in to next_out when the amounts of available input data and output space permit it, avoiding the intermediate pending buffer. Additionally, only the last 32K of the used input data is copied back to the sliding window when large input buffers are provided.
Mark Adler 37281ac2 2016-11-15T20:45:01 Add uncompress2() function, which returns the input size used.
Mark Adler 7161ad76 2016-11-22T23:29:19 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.
Mark Adler 123f9cfa 2016-12-03T08:18:56 Clean up gz* function return values. In some cases the return values did not match the documentation, or the documentation did not document all of the return values. gzprintf() now consistently returns negative values on error, which matches the behavior of the stdio fprintf() function.
Mark Adler 1101ea79 2016-11-22T12:02:29 Explicitly ignore a return value in gzwrite.c.
Mark Adler 21c66cd5 2016-11-20T11:36:15 Increase verbosity required to warn about bit length overflow. When debugging the Huffman coding would warn about resulting codes greater than 15 bits in length. This is handled properly, and is not uncommon. This increases the verbosity of the warning by one, so that it is not displayed by default.
Mark Adler 001300d0 2016-11-14T10:19:25 Minor edits to the documentation in source file contents.
Mark Adler 9674807c 2016-11-05T22:55:34 Fix bugs in creating a very large gzip header.
Mark Adler fc130cdd 2016-10-30T09:33:25 Add --debug (-d) option to ./configure to define ZLIB_DEBUG.
Mark Adler a456d898 2016-10-30T09:25:32 Use memcpy for stored blocks. This speeds up level 0 by about a factor of three, as compared to the previous byte-at-a-time loop. We can do much better though. A later commit avoids this copy for level 0 with large buffers, instead copying directly from the input to the output. This commit still speeds up storing incompressible data found when compressing normally.
Mark Adler 03614c56 2016-10-30T08:36:13 Fix some typos.
Mark Adler 94575859 2016-10-27T22:50:43 Fix bug when level 0 used with Z_HUFFMAN or Z_RLE. Compression level 0 requests no compression, using only stored blocks. When Z_HUFFMAN or Z_RLE was used with level 0 (granted, an odd choice, but permitted), the resulting blocks were mostly fixed or dynamic. The reason is that deflate_stored() was not being called in that case. The compressed data was valid, but it was not what the application requested. This commit assures that only stored blocks are emitted for compression level 0, regardless of the strategy selected.
Mark Adler bedea248 2016-10-26T10:25:10 Clean up and comment the use of local for static.
Mark Adler ce12c5cd 2016-10-25T20:45:41 Make a noble effort at setting OS_CODE correctly. This updates the OS_CODE determination at compile time to match as closely as possible the operating system mappings documented in the PKWare APPNOTE.TXT version 6.3.4, section 4.4.2.2. That byte in the gzip header is used by nobody for anything, as far as I can tell. However we might as well try to set it appropriately.
Mark Adler b516b4bd 2016-10-24T20:11:41 Do a more thorough check of the state for every stream call. This verifies that the state has been initialized, that it is the expected type of state, deflate or inflate, and that at least the first several bytes of the internal state have not been clobbered.
Mark Adler 77fd7e56 2016-10-24T16:00:51 Document the rejection of 256-byte window requests in zlib.h.
Mark Adler 049578f0 2016-10-24T15:52:19 Reject a window size of 256 bytes if not using the zlib wrapper. There is a bug in deflate for windowBits == 8 (256-byte window). As a result, zlib silently changes a request for 8 to a request for 9 (512-byte window), and sets the zlib header accordingly so that the decompressor knows to use a 512-byte window. However if deflateInit2() is used for raw deflate or gzip streams, then there is no indication that the request was not honored, and the application might assume that it can use a 256-byte window when decompressing. This commit returns an error if the user requests a 256-byte window when using raw deflate or gzip encoding.
Mark Adler a0bf0f31 2016-10-14T13:30:18 Avoid obfuscating use of default case in inftrees.c.
Mark Adler da64f173 2016-10-14T13:18:58 Move macro definition in deflate.c to where it is used. This avoid defining a macro that is never used when not debugging.
Mark Adler ebbc5739 2016-10-14T13:16:07 Avoid recursive gzgetc() macro call. Recursive macro calls are normally caught by the preprocessor and avoided. This commit avoids the possibility of a problem entirely.
Mark Adler 7d6956b6 2016-10-14T13:10:54 Make globals in examples local to compilation unit.
Mark Adler 8b95fa19 2016-10-11T22:21:04 Add --warn option to ./configure, instead of environment variable.
Mark Adler 7096424f 2016-10-11T22:15:50 Clean up type conversions.
Mark Adler 2edb94a3 2016-10-11T18:38:20 Avoid casting an out-of-range value to long.
Mark Adler e08118c4 2016-10-03T22:33:26 Note the violation of the strict aliasing rule in crc32.c. See the comment for more details. This is in response to an issue raised as a result of a security audit of the zlib code by Trail of Bits and TrustInSoft, in support of the Mozilla Foundation.
Mark Adler d1d57749 2016-09-28T20:20:25 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.
Mark Adler 6a043145 2016-09-21T23:35:50 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.
Mark Adler 9aaec95e 2016-09-21T22:25:21 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.
Mark Adler 3fb251b3 2016-09-21T20:07:37 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."
Mark Adler 33a7aff4 2016-09-21T08:45:59 Fix typo.
Mark Adler 9852c209 2016-09-20T18:49:21 Add option to not compute or check check values. The undocumented (except in these commit comments) function inflateValidate(strm, check) can be called after an inflateInit(), inflateInit2(), or inflateReset2() with check equal to zero to turn off the check value (CRC-32 or Adler-32) computation and comparison. Calling with check not equal to zero turns checking back on. This should only be called immediately after the init or reset function. inflateReset() does not change the state, so a previous inflateValidate() setting will remain in effect. This also turns off validation of the gzip header CRC when present. This should only be used when a zlib or gzip stream has already been checked, and repeated decompressions of the same stream no longer need to be validated.
Mark Adler 93b0af4a 2016-09-20T17:27:28 Correct the size of the inflate state in the comments.
Mark Adler 70a8763b 2016-07-10T11:43:17 Fix typo in blast.c.
Mark Adler 2bcfc311 2016-06-17T19:36:10 Add configure.log to .gitignore.
Mark Adler 4f1df003 2016-04-05T03:09:59 Loop on write() calls in gzwrite.c in case of non-blocking I/O.
Mark Adler 4423fef8 2016-01-29T23:24:55 Fix gzseek() problem on MinGW due to buggy _lseeki64 there.
Mark Adler 6cef1de7 2015-11-26T22:52:25 Fix bug that accepted invalid zlib header when windowBits is zero. When windowBits is zero, the size of the sliding window comes from the zlib header. The allowed values of the four-bit field are 0..7, but when windowBits is zero, values greater than 7 are permitted and acted upon, resulting in large, mostly unused memory allocations. This fix rejects such invalid zlib headers.
Mark Adler 8f1b3744 2015-10-04T11:45:00 Use a consistent and more modern approach to not use a parameter. A remarkably creative and diverse set of approaches to letting the compiler know that opaque was being used when it wasn't is changed by this commit to the more standard (void)opaque.
Mark Adler f77c9823 2015-09-16T15:40:00 Use UTF-8 for non-ASCII characters in ChangeLog.
Mark Adler 44ae761d 2015-09-05T18:56:55 Clean up portability for shifts and integer sizes.
Mark Adler e54e1299 2015-09-05T17:45:55 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.
Mark Adler 27ef0266 2015-08-15T18:14:50 Fix typo.
Mark Adler 82e9dc60 2015-08-15T18:04:50 Use const for static tree descriptions in deflate. This is in order to permit shared memory for these structures.
Mark Adler 55d98b4c 2015-08-02T14:46:58 Allow building zlib outside of the source directory. To build, simply run configure from the source directory by specifying its path. That path will be used to find the source files. The source directory will not be touched. All new and modified files will be made in the current directory. Discovered in the process that not all makes understand % or $<, and not all compilers understand -include or -I-. This required a larger Makefile.in with explicit dependencies.
Mark Adler bfcace04 2015-08-02T16:47:14 Do not initialize unsigned with -1 in compress.c uncompr.c. Sun compiler complained. Use (unsigned)0 - 1 instead.
Mark Adler 43bfaba3 2015-08-02T00:02:07 Align deflateParams() and its documentation in zlib.h. This updates the documentation to reflect the behavior of deflateParams() when it is not able to compress all of the input data provided so far due to insufficient output space. It also assures that data provided is compressed before the parameter changes, even if at the beginning of the stream.
Mark Adler b4ce6caf 2015-08-01T17:38:56 Compile the gzopen_w() function when __CYGWIN__ defined.
Mark Adler 2fc6d667 2015-07-28T23:32:35 Define _POSIX_SOURCE to enable POSIX extensions on some systems.
Mark Adler 5701f48c 2015-07-28T23:17:49 Clarify deflateReset() documentation. It previously could have been misinterpreted to mean that parameter changes after deflateInit2() would be reversed, which is not the case.
Mark Adler c901a34c 2015-07-28T23:13:53 Avoid uninitialized access by gzclose_w().
Mark Adler 51a223de 2015-07-28T22:44:31 Avoid use of DEBUG macro -- change to ZLIB_DEBUG.
Mark Adler 0b223371 2015-07-28T21:55:09 Avoid use of reallocf() in test/infcover.c.
Mark Adler 0db8fd37 2015-07-28T21:41:20 Fix inflateInit2() bug when windowBits is 16 or 32. A windowBits value of 0, 16, or 32 gets the window bits from the zlib header. However there is no zlib header for 16, or for 32 when the input is gzip. This commit sets the window bits for inflate to 15 if a gzip stream is detected and windowBits was 16 or 32.
Mark Adler b56d1c62 2015-07-28T21:06:06 Add comment about not using windowBits of 8 for deflate().
Mark Adler e7ebb399 2015-07-07T20:11:01 Put license in zlib.3 man page. Previously there was a confusing reference to a "distribution directory".
Mark Adler 95698093 2015-07-05T18:14:53 Improve speed of gzprintf() in transparent mode.
Mark Adler 8a979f6c 2015-07-05T13:51:50 Avoid left shift of a negative value in flush rank calculation. The C standard permits an undefined result for a left shift of a negative value.
Mark Adler 9859a94c 2015-01-26T21:41:26 Remedy Coverity warning. [Randers-Pehrson]
Mark Adler 5370d99a 2014-12-29T00:18:42 Add inflateCodesUsed() function for internal use.
Mark Adler 283520ba 2014-07-02T16:34:22 Fix bug in test/example.c where error code not saved.
Mark Adler 9cbda797 2014-04-26T08:12:37 Note in zlib.h that compress() uses Z_DEFAULT_COMPRESSION.
Mark Adler 7d54c694 2014-04-26T08:04:09 Fix uncompress() to work on lengths more than a maximum unsigned.
Mark Adler f898bbed 2014-04-25T21:52:19 Fix compress() to work on lengths more than a maximum unsigned.
Mark Adler 72c70060 2014-04-24T19:45:36 Assure that gzoffset() is correct when appending. An open() with O_APPEND followed by an lseek() to determine the position will return zero for a non-empty file, even though the next write will start at the end of the file. This commit works around that by doing an lseek() to the end when appending.
Mark Adler 799c87c0 2013-08-24T01:53:31 Improve contrib/blast to return unused bytes. Fix the test code to report the count of unused bytes at the end correctly. Add the ability to provide initial input to blast().
Mark Adler 89e335ab 2013-08-03T18:13:23 Fix contrib/minizip to permit unzipping with desktop API [Zouzou].
Mark Adler 303d92cf 2013-05-23T20:11:54 Spacing cleanup.
Mark Adler ceeb615f 2013-05-02T23:12:54 Change version number to 1.2.8.1.
Mark Adler 50893291 2013-04-28T16:03:34 zlib 1.2.8
Mark Adler 5b5da456 2013-04-28T17:21:50 Fix mixed line endings in contrib/vstudio.
Mark Adler 2dad5389 2013-04-28T15:36:25 Correct spelling error in zlib.h.
Mark Adler b4d80282 2013-04-18T21:47:59 Clean up contrib/vstudio [Roß].
Mark Adler f5ec2634 2013-04-18T21:38:15 Update some copyright years.
Mark Adler bddc968b 2013-04-14T10:31:31 Do not force Z_CONST for C++. Forcing Z_CONST resulted in an issue when compiling Firefox. Now if someone wants to compile zlib as C++ code (which it isn't), now they will need to #define Z_CONST themselves.
Mark Adler 5481269e 2013-04-14T10:05:43 Update contrib/minizip/iowin32.c for Windows RT [Vollant].
Mark Adler e8fee0ea 2013-04-13T21:38:26 Change version number to 1.2.8.
Mark Adler b7bc3884 2013-04-13T21:18:35 zlib 1.2.7.3
Mark Adler c7140720 2013-04-13T19:11:47 Fix version numbers and DLL names in contrib/vstudio/*/zlib.rc.
Mark Adler 388a285c 2013-04-13T18:58:46 Change version number to 1.2.7.3.
Mark Adler 139c67fc 2013-04-13T18:15:42 zlib 1.2.7.2
Mark Adler 70252daf 2013-04-13T18:04:06 Add casts in gzwrite.c for pointer differences.
Mark Adler 9b703f20 2013-04-13T17:54:57 Fix typo in win32/Makefile.msc.
Mark Adler 5d33c62c 2013-04-13T15:54:03 Change check for a four-byte type back to hexadecimal.
Mark Adler 8a93f49c 2013-04-13T08:08:57 Change version number to 1.2.7.2.
Mark Adler 0b166094 2013-03-24T22:46:40 zlib 1.2.7.1
Mark Adler f81b79c5 2013-03-24T22:30:40 Line length cleanup.
Mark Adler c661c374 2013-03-24T22:12:31 Do not return Z_BUF_ERROR if deflateParam() has nothing to write. If the compressed data was already at a block boundary, then deflateParam() would report Z_BUF_ERROR, because there was nothing to write. With this patch, Z_OK is returned in that case.
Mark Adler 81c3068b 2013-03-24T16:57:32 In Makefile uninstall, don't rm if preceding cd fails.
Mark Adler d3b613e3 2013-03-24T16:56:05 Minor spacing cleanup in a comment in gzguts.h.
Enrico Weigelt, metux IT service 318a5e19 2010-07-06T20:06:08 Add man pages for minizip and miniunzip.
Mark Adler e9f0b784 2013-03-24T15:18:02 Add casts and consts to ease user conversion to C++. You would still need to run zlib2ansi on all of the *.c files.
Mark Adler 0aac8cf7 2013-03-23T23:47:15 Clean up the addition of gzvprintf.
Mark Adler f0546c8e 2013-03-23T22:57:27 Clean up the addition of inflateGetDictionary.
Mark Adler 03ff48cc 2013-03-23T22:27:43 Remove runtime check in configure for four-byte integer type. That didn't work when cross-compiling. Simply rely on limits.h. If a compiler does not have limits.h, then zconf.h.in should be modified to define Z_U4 as an unsiged four-byte integer type in order for crc32() to be fast. This also simplifies and makes more portable to check for a four- byte type using limits.h.
Mark Adler 66fcefbb 2013-03-23T13:50:10 Fix configure for Sun shell.
Mark Adler b06dee43 2013-03-22T18:32:37 Add gzvprintf() as an undocumented function in zlib. The function is only available if stdarg.h is available.
Mark Adler dd5d0940 2013-03-22T17:38:37 Add vc11 and vc12 build files to contrib/vstudio.
Mark Adler a2d71e8e 2013-02-24T00:16:24 Fix typos in the use of _LARGEFILE64_SOURCE in zconf.h.