Don't enable debug when building with code coverage.
Don't disable optimization when building with code coverage.
Make sure GCC links with gcov, like the docs says you should.
Added better aligned access support for put_short.
Renamed putShortMSB to put_short_msb and moved to deflate.h with the rest of the put functions.
Added put_uint32 and put_uint32_msb and replaced instances of put_byte with put_short or put_uint32.
Fixed formatting, 4 spaces for code intent, 2 spaces for preprocessor indent, initial function brace on the same line as definition, removed extraneous spaces and new lines.
Added gzip tests for all open modes and compression levels for more code coverage.
Added tests for gzip compress/uncompress for all open modes.
Added test data from Google snappy project and include copying info.
Mika Lindqvist [Mon, 25 Nov 2019 23:23:50 +0000 (01:23 +0200)]
Compatibility fix for crc32()
* Use "unsigned long" externally instead of "uint32_t" for crc
* Use "unsigned int" externally instead of "uint32_t" for len
Mark Adler [Thu, 3 Jan 2019 02:10:40 +0000 (18:10 -0800)]
Don't bother computing check value after successful inflateSync().
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.
Clean up LIKELY/UNLIKELY definitions, making them upper-case to improve visibility.
Add LIKELY_NULL hint.
Add PREFETCH_L1, PREFETCH_L2 and PREFETCH_RW for GCC, Clang, ICC and MSVC.
Added github actions yaml for cmake and configure.
Added cmake toolchain files for qemu powerpc, sparc64, and s390x.
Turn off shared libs for qemu and use static builds for qemu.
Fixed maintainer mode being overwriting when in CI by options parsing.
Set CI environment variable to enable Fuzzers by default.
Added support for code-coverage for all tests.
Reduce indirections used by send_bits and send_code.
Also simplify the debug tracing into the define instead
of using a separate static function.
x86_64 shows a small performance improvement.
travis.yml changes:
- Select minimal vm image instead of generic ('C'), reducing size and boot time.
- Windows needs 'C' image to not hang on booting
- Update from Xenial to Bionic for linux tests.
- ppc64 images don't have Bionic, set to Xenial
- ppc64 is having misc failures with Xenial tools, so use GCC-9 and Clang-6
- ppc64 cannot run MSAN
- Add another test for more complete testing across architectures.
- Enable fuzzers, msan and/or sanitizers most various tests.
- Disable ASAN leak detection on aarch64, since it crashes under qemu
- Reorder tests to be better grouped and running windows/macox tests lasts.
- Enable verbose messages from sanitizers
CmakeLists.txt changes:
- Enable warnings by default.
- Add MAINTAINER setting to cmake
- Enables extra warnings.
- Enables fuzzers.
- Add CI detection to cmake, currently auto-enables MAINTAINER mode.
- Add detection of several more sanitizer features.
- Test sanitizer features together, not just alone.
This also helps with their inter-dependencies.
Unify detection of ARM getauxval code availability.
We don't want to compile arch-specific code when WITH_OPTIM is not set,
and the current checks don't take that into account.
travis.yml changes:
- Add shorthand-variables for some of the long parameters often used
- Enable --warn in a couple configure tests that did not have it enabled.
- Make travis print out CMakeError.log or configure.log in after_failure.
- Reorder some cmake parameters to improve consistency
- Disable ccache. Downloading and uploading the cache archive is quite slow,
especially if travis is having network-connectivity issues.
Also ccache caches gcno (coverage) files, making the coverage data wrong
because it is being shared across builds, branches and PRs.
CmakeLists.txt changes:
- Enable -Wall by default in cmake.
Make travis retry its operations, to attempt to avoid many of the
failed builds due to silly things like git failed to look up github.com
or apt failed to install deps due to network timeout, etc.
Make curl retry download of codecov bash script, and
make codecov re-try the uploads, since all the network errors
travis has is causing erratic coverage data.
Jim Kukunas [Thu, 8 Dec 2016 04:13:26 +0000 (20:13 -0800)]
crc_folding: use temp buffer for partial stores
With deflate, the only destination for crc folding was the window, which
was guaranteed to have an extra 15B of padding (because we allocated it).
This padding allowed us to handle the partial store case (len < 16)
with a regular SSE store.
For inflate, this is no longer the case. For crc folding to be
efficient, it needs to operate on large chunks of the data each call.
For inflate, this means copying the decompressed data out to the
user-provided output buffer (moreso with our reorganized window). Since
it's user-provided, we don't have the padding guarantee and therefore
need to fallback to a slower method of handling partial length stores.
Nicolas Trangez [Thu, 3 Mar 2016 17:17:43 +0000 (18:17 +0100)]
crc_folding: Fix potential out-of-bounds access
In some (very rare) scenarios, the SIMD code in the `crc_folding` module
can perform out-of-bounds reads or writes, which could lead to GPF
crashes.
Here's the deal: when the `crc_fold_copy` function is called with a
non-zero `len` argument of less then 16, `src` is read through
`_mm_loadu_si128` which always reads 16 bytes. If the `src` pointer
points to a location which contains `len` bytes, but any of the `16 -
len` out-of-bounds bytes falls in unmapped memory, this operation will
trigger a GPF.
The same goes for the `dst` pointer when written to through
`_mm_storeu_si128`.
With this patch applied, the crash no longer occurs.
We first discovered this issue though Valgrind reporting an
out-of-bounds access while running a unit-test for some code derived
from `crc_fold_copy`. In general, the out-of-bounds read is not an issue
because reads only occur in sections which are definitely mapped
(assuming page size is a multiple of 16), and garbage bytes are ignored.
While giving this some more thought we realized for small `len` values
and `src` or `dst` pointers at a very specific place in the address
space can lead to GPFs.
- Minor tweaks to merge request by Jim Kukunas <james.t.kukunas@linux.intel.com>
- removed C11-isms
- use unaligned load
- better integrated w/ zlib (use zalign)
- removed full example code from commit msg
Add slide_hash to functable, and enable the sse2-optimized version.
Add necessary code to cmake and configure.
Fix slide_hash_sse2 to compile with zlib-ng.
Changes to support compilation with MSVC ARM & ARM64 (#386)
* Merge aarch64 and arm cmake sections.
* Updated MSVC compiler support for ARM and ARM64.
* Moved detection for -mfpu=neon to where the flag is set to simplify add_intrinsics_option.
* Only add ${ACLEFLAG} on aarch64 if not WITH_NEON.
* Rename arch/x86/ctzl.h to fallback_builtins.h.