summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2023-04-20Merge tag '2.0.7' into tachibanatachibana-mr1tachibanaalk3pInjection
Change-Id: I7b03d60d67d184c21ff7437a35062077666951e9
2023-03-17Version 2.0.7Hans Kristian Rosbach
Changes since 2.0.6: - Fix CVE-2022-37434 #1328 - Fix chunkmemset #1196 - Fix deflateBound too small #1236 - Fix Z_SOLO #1263 - Fix ACLE variant of crc32 #1274 - Fix inflateBack #1311 - Fix deflate_quick windowsize #1431 - Fix DFLTCC bugs related to adler32 #1349 and #1390 - Fix warnings #1194 #1312 #1362 - MacOS build fix #1198 - Add invalid windowBits handling #1293 - Support for Force TZCNT #1186 - Support for aligned_alloc() #1360 - Minideflate improvements #1175 #1238 - Dont use unaligned access for memcpy #1309 - Build system #1209 #1233 #1267 #1273 #1278 #1292 #1316 #1318 #1365 - Test improvements #1208 #1227 #1241 #1353 - Cleanup #1266 - Documentation #1205 #1359 - Misc improvements #1294 #1297 #1306 #1344 #1348 - Backported zlib fixes - Backported CI workflows from Develop branch
2023-03-17[minigzip] Close gzFile before exiting on error.Mika T. Lindqvist
2023-03-17Narrow down the amount of packages installed for Wine.Hans Kristian Rosbach
2023-03-17Have build test report library version if it doesn't match zlib.h.Mark Adler
2023-03-17Have infback() deliver all of the available output up to any error.Mark Adler
2023-03-17Fix bug in block type selection when Z_FIXED used.Mark Adler
A fixed block could be chosen when a stored block was smaller. Now the smaller of the two is always chosen.
2023-03-17Add WIN32_LEAN_AND_MEAN for windows.h include.Mark Adler
2023-03-17Remove redundant check in gz_look().Mark Adler
2023-03-17Fix bug in deflateBound() for level 0 and memLevel 9.Mark Adler
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.
2023-03-17Fix crash when gzsetparams() attempted for transparent write.Mark Adler
gzsetparams() now returns a Z_STREAM_ERROR in this case.
2023-03-17IBM Z DFLTCC: Test with MSanIlya Leoshkevich
* Add __msan_unpoison() calls to DFLTCC inline assembly. * Make parameter block sizes symbolic constants. * Move dfltcc() definition after struct dfltcc_param_v0 definition. Backported from commit 1f5ddcc009ac3511e99fc88736a9e1a6381168c5.
2023-03-17Use _msan_unposion to unposion end of window for when it needs to read the ↵Nathan Moinvaziri
past < chunksize bytes in the window. See #1245. Co-authored-by: Adam Stylinski <kungfujesus06@gmail.com> Backported from commit c882034d48afc0b32a38e8f7ca63a2e4e91ab42d.
2023-03-17Adjust thread counts for compiles and tests to avoid under-utilization and ↵Hans Kristian Rosbach
congestion. The free Github Actions VMs have 2 cores, the dedicated s390x VM has 4 cores.
2023-03-17Update abicheckHans Kristian Rosbach
2023-03-17Backport CMake toolchain files from current 'develop' branch.Hans Kristian Rosbach
2023-03-17Backport latest CI workflows from 'develop'.Hans Kristian Rosbach
Removed tests for features not supported in 2.0.x: - cxx related settings, as stable does not use gtest/gbench. - Emscripten - Add_subdirectory - Symbol prefix - oss-fuzz, their buildfile is incompatible with this branch
2023-03-17Fix inconsistent feature enablements in cmake and configureHans Kristian Rosbach
2023-03-17Remove gz_intmax implementation, since INT_MAX is always available in modern ↵Hans Kristian Rosbach
C implementations.
2023-03-17Remove WindowBits check for level 1Ruben Vorderman
2023-03-17IBM zSystems DFLTCC: Fix updating strm.adlerIlya Leoshkevich
inflate() does not update strm.adler with DFLTCC. deflate() updates strm.adler even for raw streams. Fix by adding wrap checks.
2023-03-17Add CodeQL workflow for GitHub code scanningLGTM Migrator
2023-03-17Makefile.in: distclean should remove zlib.pc instead of cleantch69
2023-03-17[MinGW] Disable GCC warning about using MS format specifiers in ISO C ↵Mika Lindqvist
conformant code
2023-03-17Support using aligned_alloc() for memory allocationCameron Cawley
2023-03-17Fix typo in README.mdCameron Cawley
2023-03-17Use short decompress option name for gzip compatibility. #1347Nathan Moinvaziri
Long option names in BusyBoxy is an optional feature, so use short option names by default.
2023-03-17Remove unused tryboth() functionHans Kristian Rosbach
2023-03-17Make visibility tests run the same way as the other tests.Hans Kristian Rosbach
Fix indentation.
2023-03-17Don't try to link gz* objects twice.Hans Kristian Rosbach
2023-03-17Remove errant space in cmake posix specifierHans Kristian Rosbach
2023-03-17[Compat] Don't use uint32_t for z_crc_tMika Lindqvist
* We don't include stdint.h as it must be included before stdarg.h and other headers might include stdarg.h before us See #1342
2023-03-17Actually run `configure` CI on macOS with GCCMosè Giordano
`gcc` is an alias for Apple Clang on macOS. See for example https://github.com/zlib-ng/zlib-ng/runs/7963904948?check_suite_focus=true ``` gcc -O2 -std=c11 -Wall -fPIC -DNDEBUG -DHAVE_POSIX_MEMALIGN -DWITH_GZFILEOP -fno-semantic-interposition -DHAVE_VISIBILITY_HIDDEN -DHAVE_VISIBILITY_INTERNAL -DHAVE_BUILTIN_CTZ -DHAVE_BUILTIN_CTZLL -DX86_FEATURES -DX86_AVX2 -DX86_AVX2_ADLER32 -DX86_AVX_CHUNKSET -DX86_AVX512 -DX86_AVX512_ADLER32 -DX86_MASK_INTRIN -DX86_AVX512VNNI -DX86_AVX512VNNI_ADLER32 -DX86_SSE41 -DX86_SSE42_CRC_HASH -DX86_SSE42_ADLER32 -DX86_SSE42_CRC_INTRIN -DX86_SSE2 -DX86_SSE2_CHUNKSET -DX86_SSSE3 -DX86_SSSE3_ADLER32 -DX86_PCLMULQDQ_CRC -DPIC -I/Users/runner/work/zlib-ng/zlib-ng -c -o adler32.lo /Users/runner/work/zlib-ng/zlib-ng/adler32.c clang: warning: argument unused during compilation: '-fno-semantic-interposition' [-Wunused-command-line-argument] ``` In order to use the real GCC you have to call `gcc-9`, `gcc-10`, or `gcc-11`: https://github.com/actions/runner-images/blob/06dd4c14e4aa8c14febdd8d6cf123b8d770b4e4a/images/macos/macos-11-Readme.md#language-and-runtime.
2023-03-17Add CVE-2022-37434 test.Vladislav Shchapov
Signed-off-by: Vladislav Shchapov <vladislav@shchapov.ru>
2023-03-17If the extra field was larger than the space the user provided withMika Lindqvist
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. See #1323.
2023-03-17cmake: respect custom `RC` flags and delete `GCC_WINDRES`Viktor Szakats
Before this patch, `zlib.rc` was compiled using a manual command [1] when using the MinGW (and MSYS/Cygwin) toolchains. This method ignores `CMAKE_RC_FLAGS` and offers no other way to pass a custom flag, breaking the build in cases where a custom `windres` option is required. E.g. `--target=` or `-I` on some platforms and configuration, in particular with `llvm-windres`. This patch deletes the special case for these toolchains and lets CMake compile the `.rc` file the default way used for all Windows targets. I'm not entirely sure why this special case was added back in 2011. The need to pass `-DGCC_WINDRES` is my suspect. We can resolve this much simpler by adding this line for the targets that require it: set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -DGCC_WINDRES") But, the `.rc` line protected by `GCC_WINDRES`, these days work just fine with `windres`. Moreover, that protected line are oboslete flags from the 16-bit era, which for a long time have no effect, as documented here: <https://docs.microsoft.com/windows/win32/menurc/common-resource-attributes> So, this patch deletes `GCC_WINDRES` from the project entirely. [1] dc5a43e
2023-03-17Treat arm64 as aarch64 for Apple M1.Mika Lindqvist
2023-03-17Fixed functions declared without a prototype warning in tools.Nathan Moinvaziri
tools/maketrees.c:101:29: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] static void gen_trees_header() tools/makecrct.c:65:27: warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes] static void make_crc_table()
2023-03-17Fix inflateBack to detect invalid input with distances too far.Mark Adler
2023-03-17Don't use unaligned access for memcpy instructions due to GCC 11 assuming it ↵Nathan Moinvaziri
is aligned in certain instances. Backport note: Removed a lot of the original commit due to merge conflicts
2023-03-17Don't use zlib fork identifier in copyright statement.Nathan Moinvaziri
2023-03-17Use 15 (0xf) for ZLIB_VER_SUBREVISION to indicate zlib fork.Nathan Moinvaziri
2023-03-17In compatibility mode, always define z_crc_t as uint32_t for backwards ↵Mika Lindqvist
compatibility.
2023-03-17Extend GZIP conditionalTobias Stoeckmann
If gzip support has been disabled during compilation then also consider gzip relevant states as invalid in deflateStateCheck. Also the gzip state definitions can be removed. This change leads to failure in test/example, and I am not sure what the GZIP conditional is trying to achieve. All gzip related functions are still defined in zlib.h Alternative approach is to remove the GZIP define.
2023-03-17Handle invalid windowBits in init functionsTobias Stoeckmann
Negative windowBits arguments are eventually turned positive in deflateInit2_ and inflateInit2_ (more precisely in inflateReset2). Such values are used to indicate that raw deflate/inflate should be performed. If a user supplies INT32_MIN for windowBits, the code will perform -INT32_MIN which does not fit into int32_t. In fact, this is undefined behavior in C and should be avoided. Clearly this is a user error, but given the careful validation of input arguments a few lines later in deflateInit2_ I think this might be of interest. Proof of Concept: - Compile zlib-ng with gcc -ftrapv or -fsanitize=undefined - Compile and run this program: ``` #include <limits.h> #include <stdio.h> #include <zlib-ng.h> int main(void) { zng_stream de_stream = { 0 }, in_stream = { 0 }; int result; result = zng_deflateInit2(&de_stream, 0, Z_DEFLATED, INT32_MIN, MAX_MEM_LEVEL, Z_DEFAULT_STRATEGY); printf("zng_deflateInit2: %d\n", result); result = zng_inflateInit2(&in_stream, INT32_MIN); printf("zng_inflateInit2: %d\n", result); return 0; } ```
2023-03-17Add public compile definition for zlib-ng API so that other projects that ↵Nathan Moinvaziri
use CMake and link against the zlib project can easily determine whether or not to include "zlib-ng.h" or "zlib.h".
2023-03-17CMakeLists.txt: fix version in zlib.pc when building staticallyFabrice Fontaine
When building statically (i.e. with BUILD_SHARED_LIBS=OFF), ZLIB_FULL_VERSION is not set resulting in an empty version in zlib.pc and the following build failure with transmission: checking for ZLIB... configure: error: Package requirements (zlib >= 1.2.3) were not met: Package dependency requirement 'zlib >= 1.2.3' could not be satisfied. Package 'zlib' has version '', required version is '>= 1.2.3' Fixes: - http://autobuild.buildroot.org/results/b3b882482f517726e5c780ba4c37818bd379df82 Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
2023-03-17early return as requestedLucy Phipps
2023-03-17remove UNROLL_MORE as suggestedLucinda May Phipps
2023-03-17crc32_acle.c: make logic more consistentLucinda May Phipps