aboutsummaryrefslogtreecommitdiff
path: root/inflate.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Revert previous commit, restoring the memcpy() call.Mark Adler2025-02-021-3/+3
| | | | | The reported issue was due to an error in their test code, not in inflate. This use of memcpy() in inflate is correct.
* Avoid use of memcpy() in inflate when areas can overlap.Mark Adler2025-02-011-3/+3
|
* Avoid out-of-bounds pointer arithmetic in inflateCopy().Mark Adler2024-09-011-1/+1
| | | | | | | | Though it does not matter for code correctness, clang's UBSan injects code that complains about computing a pointer from an array where the result is out-of-bounds for that array, even though the pointer is never dereferenced. Go figure. This commit avoids that possibility when computing distcode in inflateCopy().
* Use z_const for setting msg to literal strings.Lwisce Zeng2024-04-011-21/+21
|
* Fix bug in inflateSync() for data held in bit buffer.Mark Adler2023-08-241-1/+1
|
* Remove K&R function definitions from zlib.Mark Adler2023-04-151-99/+28
| | | | | | | 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.
* Assure that inflatePrime() can't shift a 32-bit integer by 32 bits.Mark Adler2023-02-171-0/+2
| | | | | | | | | The inflate() functions never leave state->bits greater than 24, so an inflatePrime() call could not cause this. The only way this could have happened would be by using inflatePrime() to fill the bit buffer with 32 bits, and then calling inflatePrime() a *second* time asking to insert zero bits, for some reason. This commit assures that a shift by 32 bits does not occur even in that case.
* Avoid undefined negation behavior if windowBits is INT_MIN.Mark Adler2022-10-061-0/+2
|
* Fix extra field processing bug that dereferences NULL state->head.Mark Adler2022-08-081-2/+2
| | | | | The recent commit to fix a gzip header extra field processing bug introduced the new bug fixed here.
* Fix a bug when getting a gzip header extra field with inflate().Mark Adler2022-07-301-2/+3
| | | | | | | | If the extra field was larger than the space the user provided with inflateGetHeader(), and if multiple calls of inflate() delivered the extra header data, then there could be a buffer overflow of the provided space. This commit assures that provided space is not exceeded.
* zlib 1.2.12v1.2.12Mark Adler2022-03-271-1/+1
|
* Add fallthrough comments for gcc.Mark Adler2022-03-271-0/+23
| | | | Note intentional switch case fall throughs to avoid gcc warnings.
* Change macro name in inflate.c to avoid collision in VxWorks.Mark Adler2020-09-171-4/+4
|
* Don't bother computing check value after successful inflateSync().Mark Adler2019-01-021-4/+10
| | | | | | | | | | | inflateSync() is used to skip invalid deflate data, which means that the check value that was being computed is no longer useful. This commit turns off the check value computation, and furthermore allows a successful return if the compressed data terminated in a graceful manner. This commit also fixes a bug in the case that inflateSync() is used before a header is ever processed. In that case, there is no knowledge of a trailer, so the remainder is treated as raw.
* Handle case where inflateSync used when header never processed.Mark Adler2017-04-161-0/+2
| | | | | | | | | If zlib and/or gzip header processing was requested, but a header was never provided and inflateSync was used successfully, then the inflate state would be inconsistent, trying to compute a check value but with no flags set. This commit sets the inflate mode to raw in this case, since there is no other assumption that can be made if a header was requested but never seen.
* Don't compute check value for raw inflate if asked to validate.Mark Adler2017-03-301-1/+1
|
* zlib 1.2.9v1.2.9Mark Adler2016-12-311-1/+1
|
* Use a uniform approach for the largest value of an unsigned type.Mark Adler2016-12-311-1/+1
|
* Do a more thorough check of the state for every stream call.Mark Adler2016-10-241-17/+34
| | | | | | 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.
* Clean up type conversions.Mark Adler2016-10-111-7/+8
|
* Avoid casting an out-of-range value to long.Mark Adler2016-10-111-1/+1
|
* Add option to not compute or check check values.Mark Adler2016-09-201-12/+31
| | | | | | | | | | | | | | | | | | 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.
* 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.
* Clean up portability for shifts and integer sizes.Mark Adler2015-09-051-1/+1
|
* Avoid shifts of negative values inflateMark().Mark Adler2015-09-051-2/+3
| | | | | | The C standard says that bit shifts of negative integers is undefined. This casts to unsigned values to assure a known result.
* Fix inflateInit2() bug when windowBits is 16 or 32.Mark Adler2015-07-281-0/+2
| | | | | | | | 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.
* Remedy Coverity warning. [Randers-Pehrson]Mark Adler2015-01-261-1/+1
|
* Add inflateCodesUsed() function for internal use.Mark Adler2014-12-291-0/+9
|
* Clean up the usage of z_const and respect const usage within zlib.Mark Adler2012-08-131-24/+17
| | | | | | | | | This patch allows zlib to compile cleanly with the -Wcast-qual gcc warning enabled, but only if ZLIB_CONST is defined, which adds const to next_in and msg in z_stream and in the in_func prototype. A --const option is added to ./configure which adds -DZLIB_CONST to the compile flags, and adds -Wcast-qual to the compile flags when ZLIBGCCWARN is set in the environment.
* Add inflateGetDictionary() function.Mark Adler2012-05-261-0/+23
|
* zlib 1.2.6.1v1.2.6.1Mark Adler2012-02-121-1/+1
|
* Use optimized byte swap operations for Microsoft and GNU [Snyder].Mark Adler2012-02-111-7/+2
|
* Avoid the use of the Objective-C reserved name "id".Mark Adler2012-01-291-5/+5
|
* zlib 1.2.5.2v1.2.5.2Mark Adler2011-12-181-1/+1
|
* Do not set strm->adler when doing raw inflate.Mark Adler2011-12-101-1/+2
|
* Have inflate() with Z_FINISH avoid the allocation of a window.Mark Adler2011-12-101-1/+2
| | | | | | | | | inflate() avoided that allocation normally, until it was modified to update the window on a normal completion so that inflateResetKeep() could work. This patch restores that behavior, but only when Z_FINISH is used successfully to complete an inflation of a stream in a single call of inflate(). The comments in zlib.h have been updated accordingly.
* Enable dictionary setting in middle of stream, and keeping the dictionary.Mark Adler2011-12-081-13/+14
| | | | | | | | | | | | | | | | | | | This patch adds the deflateResetKeep() function to retain the sliding window for the next deflate operation, and fixes an inflateResetKeep() problem that came from inflate() not updating the window when the stream completed. This enables constructing and decompressing a series of concatenated deflate streams where each can depend on the history of uncompressed data that precedes it. This generalizes deflateSetDictionary() and inflateSetDictionary() to permit setting the dictionary in the middle of a stream for raw deflate and inflate. This in combination with the Keep functions enables a scheme for updating files block by block with the transmission of compressed data, where blocks are sent with deflateResetKeep() to retain history for better compression, and deflateSetDictionary() is used for blocks already present at the receiver to skip compression but insert that data in the history, again for better compression. The corresponding inflate calls are done on the receiver side.
* Remove code from inflate.c and infback.c that is impossible to execute.Mark Adler2011-11-271-1/+0
| | | | | | During coverage testing it was discovered that these two lines could never pull more bits, since the immediately preceding for loop assures that all of the code's bits are already pulled.
* Fix indentation of code in inflate.c.Mark Adler2011-10-091-1/+1
|
* Add undocumented inflateResetKeep() function for CAB file decoding.Mark Adler2011-10-071-4/+14
| | | | | | | | The Microsoft CAB file format compresses each block with completed deflate streams that depend on the sliding window history of the previous block in order to decode. inflateResetKeep() does what inflateReset() does, except the sliding window history from the previous inflate operation is retained.
* Add a ./config --solo option to make zlib subset with no libary useMark Adler2011-10-071-3/+12
| | | | | | | | A common request has been the ability to compile zlib to require no other libraries. This --solo option provides that ability. The price is that the gz*, compress*, and uncompress functions are eliminated, and that the user must provide memory allocation and free routines to deflate and inflate when initializing.
* Get inffixed.h and MAKEFIXED result to match.Mark Adler2011-10-051-2/+2
|
* zlib 1.2.3.7v1.2.3.7Mark Adler2011-09-091-2/+2
|
* zlib 1.2.3.6v1.2.3.6Mark Adler2011-09-091-2/+2
|
* zlib 1.2.3.5v1.2.3.5Mark Adler2011-09-091-17/+16
|
* zlib 1.2.3.4v1.2.3.4Mark Adler2011-09-091-28/+108
|
* zlib 1.2.3.3v1.2.3.3Mark Adler2011-09-091-45/+78
|
* zlib 1.2.2.4v1.2.2.4Mark Adler2011-09-091-6/+25
|
* zlib 1.2.2.3v1.2.2.3Mark Adler2011-09-091-4/+8
|
* zlib 1.2.2.2v1.2.2.2Mark Adler2011-09-091-3/+13
|