Fabrice Fontaine [Fri, 27 May 2022 21:25:21 +0000 (23:25 +0200)]
CMakeLists.txt: fix version in zlib.pc when building statically
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'
Mika Lindqvist [Tue, 5 Apr 2022 21:04:45 +0000 (00:04 +0300)]
Add one extra byte to return value of compressBound and deflateBound for small lengths due to shift returning 0.
* Treat 0 byte input as 1 byte input when calculating compressBound and deflateBound
Adam Stylinski [Fri, 18 Mar 2022 00:22:56 +0000 (20:22 -0400)]
Fix a latent issue with chunkmemset
It would seem that on some platforms, namely those which are
!UNALIGNED64_OK, there was a likelihood of chunkmemset_safe_c copying all
the bytes before passing control flow to chunkcopy, a function which is
explicitly unsafe to be called with a zero length copy.
Mika Lindqvist [Sun, 13 Mar 2022 15:12:42 +0000 (17:12 +0200)]
Allow bypassing runtime feature check of TZCNT instructions.
* This avoids conditional branch when it's known at build time that TZCNT instructions are always supported
Adam Stylinski [Thu, 17 Mar 2022 02:52:44 +0000 (22:52 -0400)]
Fix UBSAN's cry afoul
Technically, we weren't actually doing this the way C wants us to,
legally. The zmemcpy's turn into NOPs for pretty much all > 0
optimization levels and this gets us defined behavior with the
sanitizer, putting the optimized load by arbitrary alignment into the
compiler's hands instead of ours.
Backport note: Replaced zmemcpy with direct memcpy, as that is what we
end up with in a later commit anyway.
Ilya Leoshkevich [Mon, 11 Oct 2021 10:24:20 +0000 (12:24 +0200)]
IBM Z: Adjust compressBound() for DFLTCC
When DFLTCC was introduced, deflateBound() was adjusted, but
compressBound() was not, leading to compression failures when using
compressBound() + compress() with poorly compressible data.
Ilya Leoshkevich [Mon, 11 Oct 2021 11:47:20 +0000 (13:47 +0200)]
IBM Z: Do not check inflateGetDictionary() with DFLTCC
The zlib manual does not specify a strict contract for
inflateGetDictionary(), it merely says that it "Returns the sliding
dictionary being maintained by inflate", which is an implementation
detail. IBM Z inflate's behavior differs from that of software, and
may change in the future to boot.
Fix deflateBound and compressBound returning very small size estimates.
Remove workaround in switchlevels.c, so we do actual testing of this.
Use named defines instead of magic numbers where we can.
IBM Z: Run DFLTCC tests on the self-hosted builder
* Use the self-hosted builder instead of ubuntu-latest.
* Drop qemu-related settings from DFLTCC configurations.
* Install codecov only for the current user, since the self-hosted
builder runs under a restricted non-root account.
* Use actions/checkout@v2 for configure checks, since for some reason
actions/checkout@v1 cannot find git on the self-hosted builder.
* Update the testing section of the DFLTCC README.
* Add the infrastructure code for the self-hosted builder.
Fixes:
```
itkzlib-ng/inflate.c(1209,24): warning C4267: '=': conversion from 'size_t' to 'unsigned long', possible loss of data
itkzlib-ng/inflate.c(1210,26): warning C4267: '=': conversion from 'size_t' to 'unsigned long', possible loss of data
```
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