summaryrefslogtreecommitdiff
path: root/deflate.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* zlib 1.3.1v1.3.1masterMark Adler2024-01-221-2/+2
|
* Fix a bug in ZLIB_DEBUG compiles in check_match().Mark Adler2024-01-191-6/+14
| | | | | This avoids trying to compare a match starting one byte before the current window. Thanks to @zmodem (Hans) for discovering this.
* Fix the copy of pending_buf in deflateCopy() for the LIT_MEM case.Hans Wennborg2024-01-131-7/+3
|
* Add LIT_MEM define to use more memory for a small deflate speedup.Mark Adler2023-09-211-0/+21
| | | | | | | | | A bug fix in zlib 1.2.12 resulted in a slight slowdown (1-2%) of deflate. This commit provides the option to #define LIT_MEM, which uses more memory to reverse most of that slowdown. The memory for the pending buffer and symbol buffers is increased by 25%, which increases the total memory usage with the default parameters by about 6%.
* Change version number on develop branch to 1.3.0.1.Mark Adler2023-08-181-1/+1
|
* zlib 1.3v1.3Mark Adler2023-08-181-2/+2
|
* Suppress MSAN detections in deflate's slide_hash().Andrzej Hunt2023-08-121-0/+5
| | | | | | slide_hash() knowingly reads potentially uninitialized memory, see comment lower down about prev[n] potentially being garbage. In this case, the result is never used.
* Remove K&R function definitions from zlib.Mark Adler2023-04-151-333/+224
| | | | | | | 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.
* Fix bug in deflateBound() for level 0 and memLevel 9.Mark Adler2022-12-151-1/+2
| | | | | | | memLevel 9 would cause deflateBound() to assume the use of fixed blocks, even if the compression level was 0, which forces stored blocks. That could result in a bound less than the size of the compressed data. Now level 0 always uses the stored blocks bound.
* Change version number on develop branch to 1.2.13.1.Mark Adler2022-10-151-1/+1
|
* zlib 1.2.13v1.2.13Mark Adler2022-10-121-1/+1
|
* Avoid undefined negation behavior if windowBits is INT_MIN.Mark Adler2022-10-061-0/+2
|
* Remove deleted assembler code references.Mark Adler2022-10-061-16/+0
| | | | | | The code was removed, but the builds that used the code were not updated. This fixes that. Thanks to Adenilson and toxieainc for the patches.
* Minor formatting improvements.Mark Adler2022-10-051-66/+71
| | | | No code changes.
* Tighten deflateBound bounds.Mark Adler2022-10-051-22/+37
| | | | | This improves the non-default expansion from 14% down to 4% in most cases, and 13% in the remainder.
* Fix some typos.Mark Adler2022-08-231-1/+1
| | | | No code changes.
* Change version number on develop branch to 1.2.12.1.Mark Adler2022-03-271-1/+1
|
* zlib 1.2.12v1.2.12Mark Adler2022-03-271-2/+2
|
* Assure that the number of bits for deflatePrime() is valid.Mark Adler2018-04-191-1/+2
|
* Fix a bug that can crash deflate on some input when using Z_FIXED.Mark Adler2018-04-191-20/+54
| | | | | | | | | | | | | | | | | | | | | This bug was reported by Danilo Ramos of Eideticom, Inc. It has lain in wait 13 years before being found! The bug was introduced in zlib 1.2.2.2, with the addition of the Z_FIXED option. That option forces the use of fixed Huffman codes. For rare inputs with a large number of distant matches, the pending buffer into which the compressed data is written can overwrite the distance symbol table which it overlays. That results in corrupted output due to invalid distances, and can result in out-of-bound accesses, crashing the application. The fix here combines the distance buffer and literal/length buffers into a single symbol buffer. Now three bytes of pending buffer space are opened up for each literal or length/distance pair consumed, instead of the previous two bytes. This assures that the pending buffer cannot overwrite the symbol table, since the maximum fixed code compressed length/distance is 31 bits, and since there are four bytes of pending space for every three bytes of symbol space.
* Fix deflateEnd() to not report an error at start of raw deflate.Mark Adler2017-10-121-1/+3
|
* Fix CLEAR_HASH macro to be usable as a single statement.Mark Adler2017-02-151-2/+5
| | | | As it is used in deflateParams().
* Fix bug when window full in deflate_stored().Mark Adler2017-02-151-1/+1
|
* Limit hash table inserts after switch from stored deflate.Mark Adler2017-02-151-1/+9
| | | | | | | This limits hash table inserts to the available data in the window and to the sliding window size in deflate_stored(). The hash table inserts are deferred until deflateParams() switches to a non-zero compression level.
* Permit a deflateParams() parameter change as soon as possible.Mark Adler2017-02-151-3/+3
| | | | | | | | | 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.
* Change version number to 1.2.11.1.Mark Adler2017-01-151-1/+1
|
* zlib 1.2.11v1.2.11Mark Adler2017-01-151-1/+1
|
* Permit immediate deflateParams changes before any deflate input.Mark Adler2017-01-151-1/+2
| | | | | | | 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.
* Update high water mark in deflate_stored.Mark Adler2017-01-151-0/+4
| | | | | | | This avoids unnecessary filling of bytes in the sliding window buffer when switching from level zero to a non-zero level. This also provides a consistent indication of deflate having taken input for a later commit ...
* Fix deflate stored bug when pulling last block from window.Mark Adler2017-01-151-5/+5
| | | | And some cosmetic cleanups.
* Change version number to 1.2.10.1.Mark Adler2017-01-151-1/+1
|
* zlib 1.2.10v1.2.10Mark Adler2017-01-021-1/+1
|
* Add warnings when compiling with assembler code.Mark Adler2017-01-021-0/+1
| | | | | | | There have been many reports of bugs in the assembler codes intended to speed up deflate and inflate. They are third-party contributions in contrib, and so are not supported by the zlib maintainers.
* Fix bug in deflate_stored() for zero-length input.Mark Adler2017-01-021-18/+19
|
* Change version number to zlib 1.2.9.1.Mark Adler2017-01-011-2/+2
|
* zlib 1.2.9v1.2.9Mark Adler2016-12-311-1/+1
|
* Avoid some random compiler warnings on various platforms.Mark Adler2016-12-301-3/+4
|
* Add deflateGetDictionary() function.Mark Adler2016-12-301-0/+21
| | | | | Per request, but its utility is likely to be very limited. See the comments in zlib.h.
* 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-041-5/+6
| | | | | | | 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.
* Fix bugs in creating a very large gzip header.Mark Adler2016-12-041-160/+179
|
* Fix some typos.Mark Adler2016-10-301-6/+6
|
* 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.
* Do a more thorough check of the state for every stream call.Mark Adler2016-10-241-23/+36
| | | | | | 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.
* 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.
* 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.
* Clean up type conversions.Mark Adler2016-10-111-12/+12
|
* Remove dummy structure declarations for old buggy compilers.Mark Adler2016-09-211-4/+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."
* Align deflateParams() and its documentation in zlib.h.Mark Adler2015-08-021-2/+1
| | | | | | | | 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.
* Avoid uninitialized access by gzclose_w().Mark Adler2015-07-281-1/+1
|