Mika Lindqvist [Wed, 21 Jul 2021 16:26:43 +0000 (19:26 +0300)]
[arm] Disable ACLE, UNALIGNED_OK and UNALIGNED64_OK on armv7 and earlier.
* armv7 has partial support for unaligned reads, but compiler might use instructions that do not support unaligned accesses
ENH: Transition to Ubuntu 18.04 in `GitHub` actions workflows
Transition to Ubuntu 18.04 in `GitHub` actions workflows.
Fixes:
```
Ubuntu 16.04 Clang
This request was automatically failed because there were no enabled runners online to process the request for more than 1 days.
Ubuntu 16.04 GCC
This request was automatically failed because there were no enabled runners online to process the request for more than 1 days.
```
reported for example at:
https://github.com/zlib-ng/zlib-ng/actions/runs/1326434358
Official `GitHub` notice related to the removal of the 16.04 virtual
environments:
https://github.blog/changelog/2021-04-29-github-actions-ubuntu-16-04-lts-virtual-environment-will-be-removed-on-september-20-2021/
Ilya Leoshkevich [Mon, 11 Oct 2021 11:12:42 +0000 (13:12 +0200)]
IBM Z: Fix building outside of a source directory
Do not use relative includes, since they are valid only within the
source directory. Rely on the build system to pass the necessary
include flags instead.
Version 2.0.5
- Fix inflate corruption on aarch64 #1008
- Fix MSVC warnings #1002 #1013
- Minor chunkset improvements #1000 #994 #1015
- Minor cleanup #997
- Add CI test for pigz on aarch64 #1004
- Cmake improvements #996
Mika Lindqvist [Fri, 18 Jun 2021 21:10:44 +0000 (00:10 +0300)]
[chunkset_neon] Use vdupq_n_u64.
* Using vdupq_n_u64 duplicates the unsigned 64-bit integer to two consecutive aligned memory locations in stack so compiler can use wider load instructions.
All different-sized general-purpose registers overlay on ARM/AArch64, so any vector cast is no-op in assembly.
Mika Lindqvist [Fri, 18 Jun 2021 20:15:28 +0000 (23:15 +0300)]
[chunkset_neon] Don't use signed vector types.
* There is no need to convert between unsigned and signed vector types. All relevant intrinsics have versions for all unsigned vector types.
Must use safe chunk copies due to inflateBack using the same allocation for output and window. In this instance if too many bytes are written it will not correctly write matches with distances close to the window size.
Mika Lindqvist [Wed, 9 Jun 2021 16:15:12 +0000 (19:15 +0300)]
[CHUNKCOPY_SAFE] Fix off-by-one error
* When chunk size was more than 8 bytes, the comparison logic failed if safe length was one less than chunk size.
Fixed trying to uncompress after compressing in gzip direct mode which is not supported by gz functions.
https://oss-fuzz.com/testcase-detail/6194422837542912
Mika Lindqvist [Sat, 22 May 2021 05:38:46 +0000 (08:38 +0300)]
Only when using Visual C++, the static library name should be "zlibstatic"
* On CygWin, MSYS and MinGW, the static library name should be "z" like on other Unix-like systems
Paweł Wegner [Thu, 13 May 2021 15:15:37 +0000 (17:15 +0200)]
Handle HAVE_UNISTD_H defined to 0.
FFmpeg during the configure stage generates a config.h file with
```
#define HAVE_UNISTD_H 0
```
on windows. Then somewhere in FFmpeg's code there is:
```
#include "config.h" // FFmpeg's config.h
#include <zlib.h>
```
which causes zlib.h to include unistd.h on windows. It is way easier to handle the issue here than in FFmpeg.
Co-authored-by: Mika Lindqvist <postmaster@raasu.org>
Mika Lindqvist [Sun, 9 May 2021 05:17:03 +0000 (08:17 +0300)]
[ARM/AArch64] More thorough testing of getauxval() macros and includes
* 32-bit ARM and AArch64 use slightly different macros for CRC32 and NEON feature bits
* 32-bit ARM sometimes requires asm/hwcap.h for AT_HWCAP2
Viktor Szakats [Thu, 6 May 2021 17:49:21 +0000 (19:49 +0200)]
upgrade links to HTTPS
http://infozip.sourceforge.net/ is sadly not having HTTPS access
enabled. Shoutout to somebody with admin access for this project:
It would be nice to enable it and thus allowing secure access to
these pages via https://infozip.sourceforge.io/ . The option has
been there for a while now:
https://sourceforge.net/blog/introducing-https-for-project-websites/
Decompress gzip compressed archive to a separate file to prevent corruption issues on macOS. (#939)
* Decompress gzip compressed archive to a separate file to prevent corruption issues on macOS.
* Clean up fatal error messages in test-compress cmake script.
Detect hwcap flags needed for runtime detection on ARM Linux
This allows us to provide useful warning messages from cmake or
configure if the system headers don't provide the necessary flags to do
runtime detection.
Don't directly include asm/hwcap.h; fix compilation on musl aarch64
sys/auxv.h includes the appropriate headers to provide the HWCAP
constants, on both glibc and musl, which makes it unnecessary to include
asm/hwcap.h directly. And on musl, asm/hwcap.h doesn't exist.
Mika Lindqvist [Sat, 10 Apr 2021 00:13:33 +0000 (03:13 +0300)]
[ARM] Use temporary variable when loading more than 8 bits in chunkmemset_neon().
* using memcpy() forbids optimizer to optimize away the temporary variable due to aliasing rules.
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]
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.
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.
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.