]> git.ipfire.org Git - thirdparty/zlib-ng.git/log
thirdparty/zlib-ng.git
4 years agoAdd codecov.yml file to repo, previously stored at codecov.io. coverage-flags
Hans Kristian Rosbach [Tue, 23 Mar 2021 18:17:19 +0000 (19:17 +0100)] 
Add codecov.yml file to repo, previously stored at codecov.io.
Add flags so we can distinguish between the library and the tests.
Add more detailed coverage badges to README.md.

4 years agoVersion 2.0.2 2.0.2
Hans Kristian Rosbach [Mon, 22 Mar 2021 09:51:33 +0000 (10:51 +0100)] 
Version 2.0.2

4 years agoFix MSVC warnings in deflate_quick_block_open
Ilya Leoshkevich [Fri, 19 Mar 2021 21:34:32 +0000 (22:34 +0100)] 
Fix MSVC warnings in deflate_quick_block_open

Add casts in order to fix the following warnings [1]:

C:\Users\Nathan\Source\zlib-ng\test\deflate_quick_block_open.c(62,69): warning C4244: '=': conversion from '__int64' to
 'uint32_t', possible loss of data [C:\Users\Nathan\Source\zlib-ng\deflate_quick_block_open.vcxproj]
C:\Users\Nathan\Source\zlib-ng\test\deflate_quick_block_open.c(73,1): warning C4244: 'initializing': conversion from '_
_int64' to 'uint32_t', possible loss of data [C:\Users\Nathan\Source\zlib-ng\deflate_quick_block_open.vcxproj]

[1] https://github.com/zlib-ng/zlib-ng/pull/880#issuecomment-802432700

4 years agoDetect unsupported VS at configure time (and not at compile time)
tbeu [Sun, 21 Mar 2021 18:28:04 +0000 (19:28 +0100)] 
Detect unsupported VS at configure time (and not at compile time)

4 years agoSupport for posix_memalign in FreeBSD 11. #873
Nathan Moinvaziri [Sat, 20 Mar 2021 03:45:13 +0000 (20:45 -0700)] 
Support for posix_memalign in FreeBSD 11. #873

Co-authored-by: Hans Kristian Rosbach <hk-git@circlestorm.org>
Co-authored-by: concatime <concatime@users.noreply@github.com>
4 years agoOnly perform auto-detection of floating point ABI on ARM arch. #895
Nathan Moinvaziri [Sat, 20 Mar 2021 02:38:42 +0000 (19:38 -0700)] 
Only perform auto-detection of floating point ABI on ARM arch. #895

Co-authored-by: zhangn1985 <zhangn1985@users.noreply.github.com>
4 years agoRestore hash_head != 0 checks
Ilya Leoshkevich [Thu, 18 Mar 2021 13:54:46 +0000 (14:54 +0100)] 
Restore hash_head != 0 checks

Commit bc5915e2dec7 ("Fixed unsigned integer overflow ASAN error when
hash_head > s->strstart.") removed hash_head != 0 checks in fast,
medium and slow deflate, because it improved performance [1].

Unfortunately, the attached test started failing after that.
Apparently, as the comments suggest, the code implicitly relies on
matches with the beginning of the window being skipped. So restore the
check.

[1] https://github.com/zlib-ng/zlib-ng/pull/772#issuecomment-710760300

4 years agoAdded preprocessor error guards to ensure proper library usage.
Nathan Moinvaziri [Thu, 18 Mar 2021 04:19:18 +0000 (21:19 -0700)] 
Added preprocessor error guards to ensure proper library usage.

4 years agoAdd a CMake macro for simple test executables
Ilya Leoshkevich [Thu, 18 Mar 2021 13:08:20 +0000 (14:08 +0100)] 
Add a CMake macro for simple test executables

6 tests use the same pattern: build a binary linked with zlib-ng and
run it. At the moment this requires 5 near-identical lines of CMake
code, leading to proliferation of copy-paste. Introduce a macro to get
rid of it.

4 years agoDon't test corpora when processing MinGW jobs. This should reduce the time these...
Nathan Moinvaziri [Thu, 18 Mar 2021 17:01:25 +0000 (10:01 -0700)] 
Don't test corpora when processing MinGW jobs. This should reduce the time these CI runs take considerably.

4 years agoFix GNUInstallDirs includedir detection
Victor Westerhuis [Thu, 18 Mar 2021 11:21:56 +0000 (12:21 +0100)] 
Fix GNUInstallDirs includedir detection

CMake uses `INCLUDEDIR` instead of `INCDIR`.

4 years agoCmake: Accept custom install dirs in various formats from command line.
Hans Kristian Rosbach [Wed, 17 Mar 2021 18:16:46 +0000 (19:16 +0100)] 
Cmake: Accept custom install dirs in various formats from command line.

4 years agoRemove unused header checks from CMake. These are legacy checks that zlib used to...
Nathan Moinvaziri [Tue, 16 Mar 2021 16:35:37 +0000 (09:35 -0700)] 
Remove unused header checks from CMake. These are legacy checks that zlib used to use.

4 years agoFix .pc file generation in CMakeLists.txt
Victor Westerhuis [Wed, 17 Mar 2021 15:38:38 +0000 (16:38 +0100)] 
Fix .pc file generation in CMakeLists.txt

Two words were swapped in a variable name, leading to empty
libdir and includedir variables in the generated .pc files.

4 years agoVersion 2.0.1 - Hotfix 2.0.1
Hans Kristian Rosbach [Wed, 17 Mar 2021 09:24:36 +0000 (10:24 +0100)] 
Version 2.0.1 - Hotfix

4 years agoFix block_open handling in deflate_quick()
Ilya Leoshkevich [Wed, 17 Mar 2021 00:14:41 +0000 (01:14 +0100)] 
Fix block_open handling in deflate_quick()

The attached test fails with "inflate() failed", because the deflate
stream that it produces ends up being corrupted. Bisect points to the
commit e7bb6db09a18 ("Replace hash_bits, hash_size and hash_mask with
defines."), but it's most likely a coincidence.

In any case, the reason is that if we happen to simultaneously exhaust
all the buffers (in, out and bi), we return finish_started without
writing the end of block symbol, which will never happen afterwards.

Fix by adding another check to the tricky condition: if we are in the
middle of a block, return need_more instead of finish_started.

4 years agoStable release 2.0.0 2.0.0
Hans Kristian Rosbach [Mon, 8 Mar 2021 13:36:15 +0000 (14:36 +0100)] 
Stable release 2.0.0

4 years agoFix defining HAVE_SYS_SDT_H with CMake
Ilya Leoshkevich iii@linux.ibm.com [Tue, 16 Mar 2021 13:26:53 +0000 (14:26 +0100)] 
Fix defining HAVE_SYS_SDT_H with CMake

DFLTCC probe points are never activated when compiling with CMake. This
is because check_include_file() only sets an internal CMake variable,
but not a C define [1].

Fix as the link suggests - by adding an explicit add_definitions.

[1] https://cmake.org/pipermail/cmake/2015-June/060830.html

4 years agoAdded comments for cmake test scripts.
Nathan Moinvaziri [Tue, 16 Mar 2021 05:05:58 +0000 (22:05 -0700)] 
Added comments for cmake test scripts.

4 years agoAdd testing of minigzip/minideflate --help and invalid parameter
Hans Kristian Rosbach [Mon, 15 Mar 2021 10:49:26 +0000 (11:49 +0100)] 
Add testing of minigzip/minideflate --help and invalid parameter

4 years agoFix bi_valid handling in deflate_quick()
Ilya Leoshkevich iii@linux.ibm.com [Mon, 15 Mar 2021 19:15:47 +0000 (20:15 +0100)] 
Fix bi_valid handling in deflate_quick()

The attached test started failing after commit ad89d5131b29 ("Don't
write end of last block when returning finish_started."): either with
"bi_buf not flushed" message in debug builds, or by producing corrupted
output in release builds.

The problem is that we must not return finish_started when bi_buf is
not empty, because the bits there will be lost. Fix by checking that
bi_valid is not 0.

4 years agoQuote CMAKE_C_FLAGS_RELEASE
Ilya Leoshkevich iii@linux.ibm.com [Mon, 15 Mar 2021 19:15:14 +0000 (20:15 +0100)] 
Quote CMAKE_C_FLAGS_RELEASE

4 years agoUpdated location to compression testing corpora.
Nathan Moinvaziri [Mon, 15 Mar 2021 19:33:41 +0000 (12:33 -0700)] 
Updated location to compression testing corpora.

4 years ago[CMake] Add zlibstatic alias when BUILD_SHARED_LIBS is "OFF"
past-due [Sun, 14 Mar 2021 20:53:07 +0000 (16:53 -0400)] 
[CMake] Add zlibstatic alias when BUILD_SHARED_LIBS is "OFF"

4 years agoRemove misleading manpage.
Hans Kristian Rosbach [Mon, 8 Mar 2021 13:40:34 +0000 (14:40 +0100)] 
Remove misleading manpage.
README.md changes:
- Added a related projects section at the end.
- Added blank line after header where missing.
- Added extra blank line before header to make them easier to spot as plain-text.
- Changed line-length for Contributing section, to make it more readable as plain-text.

4 years agoOnly set CPU feature flags in configure script if not using native instructions.
Nathan Moinvaziri [Tue, 23 Feb 2021 05:43:24 +0000 (21:43 -0800)] 
Only set CPU feature flags in configure script if not using native instructions.

4 years agoUpload build log for pkgcheck CI when fails.
Nathan Moinvaziri [Tue, 23 Feb 2021 05:41:43 +0000 (21:41 -0800)] 
Upload build log for pkgcheck CI when fails.

4 years agoAdded pkgcheck macOS CI test for native instruction builds.
Nathan Moinvaziri [Tue, 23 Feb 2021 05:39:17 +0000 (21:39 -0800)] 
Added pkgcheck macOS CI test for native instruction builds.

4 years agoPass configure and cmake arguments to pkg/abi check scripts.
Nathan Moinvaziri [Tue, 23 Feb 2021 05:35:37 +0000 (21:35 -0800)] 
Pass configure and cmake arguments to pkg/abi check scripts.

4 years agoReduce number of mingw i686 and x86_64 parallel test runs due to wine errors.
Nathan Moinvaziri [Sat, 20 Feb 2021 22:57:22 +0000 (14:57 -0800)] 
Reduce number of mingw i686 and x86_64 parallel test runs due to wine errors.

4 years agoAdd porting guide.
Hans Kristian Rosbach [Sat, 30 Jan 2021 14:46:24 +0000 (15:46 +0100)] 
Add porting guide.
Sync cmake dfltcc descriptions with README.

4 years agoFix incorrect --force-sse2 info in README.md
Hans Kristian Rosbach [Sat, 12 Sep 2020 17:20:01 +0000 (19:20 +0200)] 
Fix incorrect --force-sse2 info in README.md
Describe DFLTCC options more similarly to the others.

4 years ago.github: Test with old gcc and clang by using oldest supported ubuntu.
Dan Kegel [Thu, 4 Feb 2021 01:45:23 +0000 (17:45 -0800)] 
.github: Test with old gcc and clang by using oldest supported ubuntu.

(Getting compiler version is harder than it sounds :-( so skipping that for now.)

4 years agoReduce number of mingw x86_64 parallel test runs due to wine connection timeout error.
Nathan Moinvaziri [Thu, 18 Feb 2021 03:54:24 +0000 (19:54 -0800)] 
Reduce number of mingw x86_64 parallel test runs due to wine connection timeout error.

4 years agoSet CI build error log artifact retention to 30 days.
Nathan Moinvaziri [Mon, 15 Feb 2021 02:07:59 +0000 (18:07 -0800)] 
Set CI build error log artifact retention to 30 days.

4 years agoUpload cmake and configure errors when build fails.
Nathan Moinvaziri [Sun, 14 Feb 2021 02:33:39 +0000 (18:33 -0800)] 
Upload cmake and configure errors when build fails.

4 years agoUse cmake check_c_compiler_flag for -fno-semantic-interposition compiler flag check.
Nathan Moinvaziri [Mon, 15 Feb 2021 03:03:29 +0000 (19:03 -0800)] 
Use cmake check_c_compiler_flag for -fno-semantic-interposition compiler flag check.

4 years agoMove code coverage detection into its own cmake file.
Nathan Moinvaziri [Mon, 15 Feb 2021 03:01:21 +0000 (19:01 -0800)] 
Move code coverage detection into its own cmake file.

4 years agoRe-enable code coverage for mingw i686 ci.
Nathan Moinvaziri [Mon, 15 Feb 2021 02:53:56 +0000 (18:53 -0800)] 
Re-enable code coverage for mingw i686 ci.

4 years agoLimit number of parallel test jobs to prevent wine connection timeout errors.
Nathan Moinvaziri [Mon, 15 Feb 2021 02:11:25 +0000 (18:11 -0800)] 
Limit number of parallel test jobs to prevent wine connection timeout errors.

4 years agoPrevent parallel test jobs from initializing Wine at the same time and erroring out.
Nathan Moinvaziri [Mon, 15 Feb 2021 02:14:43 +0000 (18:14 -0800)] 
Prevent parallel test jobs from initializing Wine at the same time and erroring out.

4 years agoImprove compiler detection of code coverage flags.
Nathan Moinvaziri [Sat, 13 Feb 2021 20:51:02 +0000 (12:51 -0800)] 
Improve compiler detection of code coverage flags.
Pass -coverage or flag to linker for mingw-gcc.

4 years agoDisable leak sanitizer for cross-compilation since it is not supported.
Nathan Moinvaziri [Sun, 14 Feb 2021 00:25:52 +0000 (16:25 -0800)] 
Disable leak sanitizer for cross-compilation since it is not supported.

4 years agoFixed qemu test runs for Ubuntu 20.
Nathan Moinvaziri [Sat, 13 Feb 2021 20:23:48 +0000 (12:23 -0800)] 
Fixed qemu test runs for Ubuntu 20.

4 years agoFixed clang tools package error in static analysis CI workflow.
Nathan Moinvaziri [Sat, 30 Jan 2021 23:36:04 +0000 (15:36 -0800)] 
Fixed clang tools package error in static analysis CI workflow.

4 years agoExplicitly note that the 32-bit check values are 32 bits.
Mark Adler [Fri, 5 Apr 2019 22:27:47 +0000 (15:27 -0700)] 
Explicitly note that the 32-bit check values are 32 bits.

4 years agoClarify gz* function interfaces, referring to parameter names.
Mark Adler [Mon, 31 Aug 2020 19:53:58 +0000 (12:53 -0700)] 
Clarify gz* function interfaces, referring to parameter names.

4 years agoFix error in comment on the polynomial representation of a byte.
Mark Adler [Tue, 9 Jul 2019 15:55:13 +0000 (08:55 -0700)] 
Fix error in comment on the polynomial representation of a byte.

4 years agoVersion 2.0.0 Release Candidate 2 v2.0.0-RC2
Hans Kristian Rosbach [Fri, 29 Jan 2021 08:48:01 +0000 (09:48 +0100)] 
Version 2.0.0 Release Candidate 2

4 years agoStore result of early exit trigger at the top of longest_match.
Nathan Moinvaziri [Thu, 28 Jan 2021 08:06:08 +0000 (00:06 -0800)] 
Store result of early exit trigger at the top of longest_match.

4 years agoAlways canonicalize CHOST when building original zlib even after automatic CHOST...
Nathan Moinvaziri [Mon, 25 Jan 2021 06:26:51 +0000 (22:26 -0800)] 
Always canonicalize CHOST when building original zlib even after automatic CHOST detection.

4 years agoRe-enable 32-bit machine ABI check in CI.
Nathan Moinvaziri [Mon, 25 Jan 2021 06:25:07 +0000 (22:25 -0800)] 
Re-enable 32-bit machine ABI check in CI.

4 years agoFixed missing large file defines in zconf.in that exist in zconf-ng.in. Accidentally...
Nathan Moinvaziri [Mon, 25 Jan 2021 06:23:21 +0000 (22:23 -0800)] 
Fixed missing large file defines in zconf.in that exist in zconf-ng.in. Accidentally removed from api cleanup.

https://github.com/zlib-ng/zlib-ng/commit/6dcc7bf815c803fe7712e449b3c8fee8f3ab6dda#diff-ce3e5ac484a4ca73e6533421950dbe15

4 years agoRemove debug check for match beginning at start of window.
Nathan Moinvaziri [Tue, 26 Jan 2021 00:47:37 +0000 (16:47 -0800)] 
Remove debug check for match beginning at start of window.

4 years agoUse a version of Xcode that supports ZERO_AR_DATE in pkgcheck script.
Nathan Moinvaziri [Tue, 26 Jan 2021 00:20:56 +0000 (16:20 -0800)] 
Use a version of Xcode that supports ZERO_AR_DATE in pkgcheck script.

4 years agoDisable homebrew auto cleanup on macOS CIs.
Nathan Moinvaziri [Mon, 25 Jan 2021 22:17:58 +0000 (14:17 -0800)] 
Disable homebrew auto cleanup on macOS CIs.
https://www.scivision.dev/macos-ci-homebrew-disable-cleanup/

4 years agoAdd extra space in deflate internal_state struct for future expansion.
Hans Kristian Rosbach [Fri, 15 Jan 2021 13:29:58 +0000 (14:29 +0100)] 
Add extra space in deflate internal_state struct for future expansion.
Also make internal_state struct have a static size regardless of what features have been activated.
Internal_state is now always 6040 bytes on Linux/x86-64, and 5952 bytes on Linux/x86-32.

4 years agoSync cmake variable names with names already used by %cmake macros in
Hans Kristian Rosbach [Thu, 14 Jan 2021 14:39:41 +0000 (15:39 +0100)] 
Sync cmake variable names with names already used by %cmake macros in
rpm-specs on redhat-based distros, making it easier to build corect packages.

4 years agoSet tag environment variable using new GHA environment files.
Nathan Moinvaziri [Tue, 12 Jan 2021 00:22:08 +0000 (16:22 -0800)] 
Set tag environment variable using new GHA environment files.

4 years agoUpdate abicheck git commit reference v2.0.0-RC1
Hans Kristian Rosbach [Mon, 11 Jan 2021 23:25:52 +0000 (00:25 +0100)] 
Update abicheck git commit reference

4 years agoFix SONAME version
Hans Kristian Rosbach [Mon, 11 Jan 2021 23:01:56 +0000 (00:01 +0100)] 
Fix SONAME version

4 years agoVersion 2.0.0 Release Candidate 1
Hans Kristian Rosbach [Mon, 11 Jan 2021 20:38:18 +0000 (21:38 +0100)] 
Version 2.0.0 Release Candidate 1

4 years agoDisallow semantic interposition in ELF shared libraries if supported by the compiler.
Hans Kristian Rosbach [Mon, 11 Jan 2021 17:44:09 +0000 (18:44 +0100)] 
Disallow semantic interposition in ELF shared libraries if supported by the compiler.
This disallows calls to our own exported functions being replaced by LD_PRELOAD, thus
avoiding the potential bugs and allowing the compiler to optimize better.

4 years agoFixed previous match length not reset when match start reset.
Nathan Moinvaziri [Mon, 4 Jan 2021 05:16:40 +0000 (21:16 -0800)] 
Fixed previous match length not reset when match start reset.
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24294

4 years agoAdd check in check_match for invalid match position.
Nathan Moinvaziri [Mon, 4 Jan 2021 05:56:50 +0000 (21:56 -0800)] 
Add check in check_match for invalid match position.

4 years agoImprove check_match output to print hex values of mismatch characters and character...
Nathan Moinvaziri [Mon, 4 Jan 2021 05:34:57 +0000 (21:34 -0800)] 
Improve check_match output to print hex values of mismatch characters and character index.

4 years agodocs: fix simple typo, stragety -> strategy
Tim Gates [Mon, 14 Dec 2020 11:51:12 +0000 (22:51 +1100)] 
docs: fix simple typo, stragety -> strategy

There is a small typo in INDEX.md.

Should read `strategy` rather than `stragety`.

4 years agoFixed macOS CI instance to use GCC
Nathan Moinvaziri [Wed, 2 Dec 2020 06:58:19 +0000 (22:58 -0800)] 
Fixed macOS CI instance to use GCC

4 years agodarwin ios/mac m1 cpu features detection update proposal
David CARLIER [Fri, 1 Jan 2021 08:56:10 +0000 (08:56 +0000)] 
darwin ios/mac m1 cpu features detection update proposal

4 years agoSeparate sanitizers so they can be run independently.
Nathan Moinvaziri [Sun, 22 Nov 2020 22:28:12 +0000 (14:28 -0800)] 
Separate sanitizers so they can be run independently.

4 years agoSet verbosity to 0 to limit CI log output.
Nathan Moinvaziri [Wed, 4 Nov 2020 07:16:10 +0000 (23:16 -0800)] 
Set verbosity to 0 to limit CI log output.

4 years agoDisable codecov in MinGW i686 due to gcov locking error when multiple tests run at...
Nathan Moinvaziri [Wed, 4 Nov 2020 03:57:25 +0000 (19:57 -0800)] 
Disable codecov in MinGW i686 due to gcov locking error when multiple tests run at the same time.

  profiling:gzlib.c.gcda:Data file mismatch - some data files may have been concurrently updated without locking support

4 years agoAdd check that tests UNALIGNED_OK without UNALIGNED64_OK.
Hans Kristian Rosbach [Mon, 2 Nov 2020 16:58:42 +0000 (17:58 +0100)] 
Add check that tests UNALIGNED_OK without UNALIGNED64_OK.

Co-authored-by: Nathan Moinvaziri <nathan@nathanm.com>
4 years agoSeparate crc32 and crc32_combine tables so the crc32_combine tables are not included...
Nathan Moinvaziri [Tue, 10 Nov 2020 01:02:38 +0000 (17:02 -0800)] 
Separate crc32 and crc32_combine tables so the crc32_combine tables are not included when not used if statically linking. Reduces code size by 4k.

4 years agoAdd AArch64 feature detection support for FreeBSD
Greg V [Sat, 14 Nov 2020 11:29:17 +0000 (14:29 +0300)] 
Add AArch64 feature detection support for FreeBSD

4 years agoCMake: fix 'ALDER32' typo in feature info message
Greg V [Sat, 14 Nov 2020 11:14:36 +0000 (14:14 +0300)] 
CMake: fix 'ALDER32' typo in feature info message

4 years agoFixed coverity dereference after null check in gz_compress CID 303796.
Nathan Moinvaziri [Mon, 9 Nov 2020 02:26:06 +0000 (18:26 -0800)] 
Fixed coverity dereference after null check in gz_compress CID 303796.

4 years agoFixed ubsan error when building tree with no symbols. #782
Nathan Moinvaziri [Sat, 31 Oct 2020 01:40:28 +0000 (18:40 -0700)] 
Fixed ubsan error when building tree with no symbols. #782

When there are no symbols in the tree we skip build_tree calculations and emit a block using static tree with no codes.

trees.c:357:19: runtime error: unsigned integer overflow: 0 - 1 cannot be represented in type 'unsigned long'
    #0 0x1000ed79b in build_tree trees.c:357
    #1 0x1000ea3f5 in zng_tr_flush_block trees.c:649
    #2 0x100090ab0 in deflate_slow deflate_slow.c:131
    #3 0x1000572bc in zng_deflate deflate.c:990
    #4 0x1000aecd3 in gz_comp gzwrite.c:125
    #5 0x1000b05df in zng_gzclose_w gzwrite.c:511
    #6 0x1000967a4 in zng_gzclose gzlib.c:253
    #7 0x100004f70 in test_gzio example.c:133
    #8 0x100010c5b in main example.c:1034
    #9 0x7fff71f57cc8 in start+0x0 (libdyld.dylib:x86_64+0x1acc8)

4 years agoFixed conditional expression is constant maintainer warnings.
Nathan Moinvaziri [Fri, 2 Oct 2020 06:10:19 +0000 (23:10 -0700)] 
Fixed conditional expression is constant maintainer warnings.

  chunkset_tpl.h(42,47): warning C4127: conditional expression is constant
  functable.c(381,44): warning C4127: conditional expression is constant

4 years agoFixed casting warnings when comparing MAX_DIST.
Nathan Moinvaziri [Fri, 2 Oct 2020 05:57:38 +0000 (22:57 -0700)] 
Fixed casting warnings when comparing MAX_DIST.

  deflate_medium.c(127,76): warning C4244: '=': conversion from 'unsigned int' to 'Pos', possible loss of data

4 years agoFixed conversion warning when assigning wsize to Pos variable.
Nathan Moinvaziri [Fri, 2 Oct 2020 05:59:27 +0000 (22:59 -0700)] 
Fixed conversion warning when assigning wsize to Pos variable.

  deflate.c(218,1): warning C4244: 'initializing': conversion from 'unsigned int' to 'Pos', possible loss of data
  deflate.c(241,1): warning C4244: 'initializing': conversion from 'unsigned int' to 'Pos', possible loss of data

4 years agoFixed conversion warning when calling zng_tr_tally_dist. Signature for dist and len...
Nathan Moinvaziri [Fri, 2 Oct 2020 05:53:50 +0000 (22:53 -0700)] 
Fixed conversion warning when calling zng_tr_tally_dist. Signature for dist and len now match zng_emit_dist.

  deflate.c(1575,67): warning C4244: 'function': conversion from 'uint32_t' to 'unsigned char', possible loss of data
  deflate_fast.c(60,94): warning C4244: 'function': conversion from 'uint32_t' to 'unsigned char', possible loss of data
  deflate_medium.c(39,102): warning C4244: 'function': conversion from 'int' to 'unsigned char', possible loss of data
  deflate_slow.c(75,101): warning C4244: 'function': conversion from 'unsigned int' to 'unsigned char', possible loss of data

4 years agoFixed str uint32_t to uint16_t casting warnings in inflate_string_tpl.h
Nathan Moinvaziri [Fri, 2 Oct 2020 05:49:28 +0000 (22:49 -0700)] 
Fixed str uint32_t to uint16_t casting warnings in inflate_string_tpl.h

  insert_string_tpl.h(50,26): warning C4244: '=': conversion from 'const uint32_t' to 'Pos', possible loss of data
  insert_string_tpl.h(67,1): warning C4244: 'initializing': conversion from 'const uint32_t' to 'Pos', possible loss of data

4 years agoFixed match_start uint32_t to uint16_t casting warnings in deflate_medium.c
Nathan Moinvaziri [Fri, 2 Oct 2020 05:47:22 +0000 (22:47 -0700)] 
Fixed match_start uint32_t to uint16_t casting warnings in deflate_medium.c

  deflate_medium.c(204,49): warning C4244: '=': conversion from 'unsigned int' to 'uint16_t', possible loss of data
  deflate_medium.c(217,59): warning C4244: '=': conversion from 'unsigned int' to 'uint16_t', possible loss of data
  deflate_medium.c(238,46): warning C4244: '=': conversion from 'unsigned int' to 'uint16_t', possible loss of data
  deflate_medium.c(250,56): warning C4244: '=': conversion from 'unsigned int' to 'uint16_t', possible loss of data

4 years agoFixed ubsan warning in gzfread due to size_t overflow. #783
Nathan Moinvaziri [Sat, 31 Oct 2020 04:14:42 +0000 (21:14 -0700)] 
Fixed ubsan warning in gzfread due to size_t overflow. #783

gzread.c:398:18: runtime error: unsigned integer overflow: 2 * 18446744073709551615 cannot be represented in type 'unsigned long'
    #0 0x10009d31e in zng_gzfread gzread.c:398
    #1 0x100005b1a in test_gzio example.c:213
    #2 0x10001093b in main example.c:1034
    #3 0x7fff71f57cc8 in start+0x0 (libdyld.dylib:x86_64+0x1acc8)

4 years agoFixed format specifier warning in build_tree call to Tracev.
Nathan Moinvaziri [Sat, 31 Oct 2020 01:47:10 +0000 (18:47 -0700)] 
Fixed format specifier warning in build_tree call to Tracev.

  Format specifies type 'unsigned long' but the argument has type 'uint32_t' (aka 'unsigned int')

4 years agoFixed minigzip_fuzzer not compiling on latest macOS due to missing _POSIX_C_SOURCE.
Nathan Moinvaziri [Sat, 31 Oct 2020 02:33:11 +0000 (19:33 -0700)] 
Fixed minigzip_fuzzer not compiling on latest macOS due to missing _POSIX_C_SOURCE.

4 years agoRemove unnecessary name array from matrix.
Nathan Moinvaziri [Mon, 2 Nov 2020 03:12:13 +0000 (19:12 -0800)] 
Remove unnecessary name array from matrix.

4 years agoCombine option and add_feature_info in CMake.
Nathan Moinvaziri [Sun, 20 Sep 2020 19:22:44 +0000 (12:22 -0700)] 
Combine option and add_feature_info in CMake.

4 years agoSmall formatting changes in inflate.c, inflate.h and inffast.c
Hans Kristian Rosbach [Sun, 18 Oct 2020 15:31:51 +0000 (17:31 +0200)] 
Small formatting changes in inflate.c, inflate.h and inffast.c

4 years agoinflate: add SET_BAD macro, to make inflate.c a little cleaner.
Hans Kristian Rosbach [Sun, 18 Oct 2020 14:19:51 +0000 (16:19 +0200)] 
inflate: add SET_BAD macro, to make inflate.c a little cleaner.

4 years agoFixed formatting in check_c_source_compiles checks for consistency.
Nathan Moinvaziri [Sat, 17 Oct 2020 21:47:31 +0000 (14:47 -0700)] 
Fixed formatting in check_c_source_compiles checks for consistency.

4 years agoFixed ptrdiff_t redefined static analysis warning on GCC. Failing ptrdiff_t detection...
Nathan Moinvaziri [Sat, 17 Oct 2020 21:31:07 +0000 (14:31 -0700)] 
Fixed ptrdiff_t redefined static analysis warning on GCC. Failing ptrdiff_t detection due to variable unused warning combined with -Werror.

  In file included from zlib-ng/zlib-ng.h:33,
                   from zlib-ng/zutil.h:38,
                   from zlib-ng/adler32.c:7:
  zlib-ng/zconf-ng.h:118:18: error: conflicting types for ‘ptrdiff_t’
    118 | typedef uint64_t ptrdiff_t;
        |                  ^~~~~~~~~
  In file included from zlib-ng/zutil.h:31,
                   from zlib-ng/adler32.c:7:
  stddef.h:143:26: note: previous declaration of ‘ptrdiff_t’ was here
    143 | typedef __PTRDIFF_TYPE__ ptrdiff_t;
        |                          ^~~~~~~~~

4 years agoAdded verbose flag to CI to see sanitizer output.
Nathan Moinvaziri [Fri, 2 Oct 2020 05:10:40 +0000 (22:10 -0700)] 
Added verbose flag to CI to see sanitizer output.

4 years agoFixed unsigned integer overflow ASAN error when hash_head > s->strstart.
Nathan Moinvaziri [Sun, 20 Sep 2020 02:39:42 +0000 (19:39 -0700)] 
Fixed unsigned integer overflow ASAN error when hash_head > s->strstart.

  zlib-ng/deflate_medium.c:244:47: runtime error: unsigned integer overflow: 58442 - 58452 cannot be represented in type 'unsigned int'

Co-authored-by: Mika Lindqvist <postmaster@raasu.org>
Co-authored-by: Hans Kristian Rosbach <hk-git@circlestorm.org>
4 years agoElevate warnings to errors to trigger failure on static analyzer
Gabriel A. Devenyi [Tue, 29 Sep 2020 01:45:28 +0000 (21:45 -0400)] 
Elevate warnings to errors to trigger failure on static analyzer

4 years agoFix switchlevels calling deflateParams() with a stale buffer
Ilya Leoshkevich [Mon, 28 Sep 2020 19:54:54 +0000 (21:54 +0200)] 
Fix switchlevels calling deflateParams() with a stale buffer

Fixes: #776
4 years agoFix incorrect inflateSyncPoint() return value with DFLTCC
Ilya Leoshkevich [Mon, 28 Sep 2020 19:21:49 +0000 (21:21 +0200)] 
Fix incorrect inflateSyncPoint() return value with DFLTCC

DFLTCC does not provide the necessary information to implement
inflateSyncPoint() - Incomplete-Function Status and Incomplete-Function
Length are the fields that provide the relevant information, but
unfortunately it's not enough. If DFLTCC is in use, the current code
checks software decompression state and always returns 0. This
(rightfully) confuses rsync, so fix by returning Z_STREAM_ERROR
instead.

4 years agoFixed left shift ubsan warning in PULLBYTE.
Nathan Moinvaziri [Mon, 5 Oct 2020 01:36:25 +0000 (18:36 -0700)] 
Fixed left shift ubsan warning in PULLBYTE.

  infback.c:200:13: runtime error: left shift of 255 by 24 places cannot be represented in type 'int'
  624: SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /Users/runner/work/zlib-ng/zlib-ng/infback.c:200:13 in

4 years agoAvoid shifts of negative values inflateMark().
Mark Adler [Sun, 6 Sep 2015 00:45:55 +0000 (17:45 -0700)] 
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.