summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* Detect clang in cc version.Mark Adler2016-12-301-0/+1
|
* Fix init macros to use z_ prefix when requested.Mark Adler2016-12-304-16/+47
|
* Fix character encoding and link in contrib README.Mark Adler2016-12-301-2/+2
|
* Use snprintf() for later versions of Microsoft C.Mark Adler2016-12-302-5/+4
|
* Add deflateGetDictionary() function.Mark Adler2016-12-302-0/+43
| | | | | Per request, but its utility is likely to be very limited. See the comments in zlib.h.
* No need to check for NULL argument to free().Mark Adler2016-12-301-4/+2
|
* Add gzfwrite(), duplicating the interface of fwrite().Mark Adler2016-12-042-40/+112
|
* Add gzfread(), duplicating the interface of fread().Mark Adler2016-12-042-40/+126
|
* Fix compile option for when z_size_t needs to be a long long.Mark Adler2016-12-044-1/+7
|
* Create z_size_t and z_ssize_t types.Mark Adler2016-12-048-17/+144
| | | | | | 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.
* Don't need to emit an empty fixed block when changing parameters.Mark Adler2016-12-041-1/+1
| | | | | | 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.
* Clean up gz* function return values.Mark Adler2016-12-043-34/+37
| | | | | | | 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.
* Speed up deflation for level 0 (storing).Mark Adler2016-12-041-78/+215
| | | | | | | | | | | | | | | | | | 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.
* Assure that deflateParams() will not switch functions mid-block.Mark Adler2016-12-042-22/+24
| | | | | | | 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.
* Explicitly ignore a return value in gzwrite.c.Mark Adler2016-12-041-1/+1
|
* Increase verbosity required to warn about bit length overflow.Mark Adler2016-12-041-2/+2
| | | | | | | 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.
* Add uncompress2() function, which returns the input size used.Mark Adler2016-12-042-18/+39
|
* Minor edits to the documentation in source file contents.Mark Adler2016-12-044-93/+109
|
* Fix bugs in creating a very large gzip header.Mark Adler2016-12-042-169/+191
|
* Add --debug (-d) option to ./configure to define ZLIB_DEBUG.Mark Adler2016-12-041-0/+6
|
* Use memcpy for stored blocks.Mark Adler2016-12-041-30/+7
| | | | | | | | | 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.
* Fix some typos.Mark Adler2016-10-3010-29/+29
|
* Fix bug when level 0 used with Z_HUFFMAN or Z_RLE.Mark Adler2016-10-271-3/+4
| | | | | | | | | | | 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.
* Clean up and comment the use of local for static.Mark Adler2016-10-264-6/+6
|
* Make a noble effort at setting OS_CODE correctly.Mark Adler2016-10-251-14/+30
| | | | | | | | 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.
* Do a more thorough check of the state for every stream call.Mark Adler2016-10-243-41/+72
| | | | | | 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.
* Document the rejection of 256-byte window requests in zlib.h.Mark Adler2016-10-241-0/+4
|
* Reject a window size of 256 bytes if not using the zlib wrapper.Mark Adler2016-10-241-1/+1
| | | | | | | | | | | | 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.
* Avoid obfuscating use of default case in inftrees.c.Mark Adler2016-10-141-1/+1
|
* Move macro definition in deflate.c to where it is used.Mark Adler2016-10-141-3/+4
| | | | This avoid defining a macro that is never used when not debugging.
* Avoid recursive gzgetc() macro call.Mark Adler2016-10-141-2/+2
| | | | | Recursive macro calls are normally caught by the preprocessor and avoided. This commit avoids the possibility of a problem entirely.
* Make globals in examples local to compilation unit.Mark Adler2016-10-142-4/+4
|
* Add --warn option to ./configure, instead of environment variable.Mark Adler2016-10-111-1/+3
|
* Clean up type conversions.Mark Adler2016-10-119-57/+62
|
* Avoid casting an out-of-range value to long.Mark Adler2016-10-111-1/+1
|
* Note the violation of the strict aliasing rule in crc32.c.Mark Adler2016-10-031-0/+12
| | | | | | 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.
* Avoid pre-decrement of pointer in big-endian CRC calculation.Mark Adler2016-09-281-3/+1
| | | | | | | | | | | | | | 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.
* Remove offset pointer optimization in inftrees.c.Mark Adler2016-09-211-10/+8
| | | | | | | | | | | 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.
* Use post-increment only in inffast.c.Mark Adler2016-09-211-50/+31
| | | | | | | | | | 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.
* Remove dummy structure declarations for old buggy compilers.Mark Adler2016-09-216-28/+0
| | | | | | | | | | | | | | 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."
* Fix typo.Mark Adler2016-09-211-1/+1
|
* Add option to not compute or check check values.Mark Adler2016-09-203-13/+34
| | | | | | | | | | | | | | | | | | 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.
* Correct the size of the inflate state in the comments.Mark Adler2016-09-201-1/+2
|
* Fix typo in blast.c.Mark Adler2016-07-101-1/+1
|
* Add configure.log to .gitignore.Mark Adler2016-06-171-0/+1
|
* Loop on write() calls in gzwrite.c in case of non-blocking I/O.Mark Adler2016-04-051-11/+16
|
* Fix gzseek() problem on MinGW due to buggy _lseeki64 there.Mark Adler2016-01-291-1/+1
|
* Fix bug that accepted invalid zlib header when windowBits is zero.Mark Adler2015-11-261-1/+1
| | | | | | | | 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.
* Use a consistent and more modern approach to not use a parameter.Mark Adler2015-10-041-6/+10
| | | | | | 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.
* Use UTF-8 for non-ASCII characters in ChangeLog.Mark Adler2015-09-161-3/+3
|