Skip to content

Update embedded zlib-ng version to 2.0.7 #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Changelog

version 0.2.0-dev
-----------------
+ Update embedded zlib-ng version to 2.0.7
+ Escape GIL for adler32 and crc32 functions.

version 0.1.0
Expand Down
7 changes: 1 addition & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,8 @@ Differences with zlib and gzip modules

.. differences start

+ Compression level 1 zlib_ng has a much worse compression rate than that in
+ Compression level 1 zlib_ng has a worse compression rate than that in
zlib. For other compression levels zlib_ng compresses better.
+ Compression level 1 does not apply requested ``wbits`` correctly. For example
compressing with ``zlib_ng.compress(data, level=1, wbits=-9)`` results in
data that cannot be decompressed with ``zlib_ng.decompress(data, wbits=-9)``
as this will throw an error mentioning invalid window sizes. This is a
bug in the included zlib-ng 2.0.6.
+ ``gzip_ng.open`` returns a class ``GzipNGFile`` instead of ``GzipFile``. Since
there are differences between the compressed ratios between levels, a
difference in naming was chosen to reflect this.
Expand Down
2 changes: 1 addition & 1 deletion src/zlib_ng/zlib-ng
Submodule zlib-ng updated 76 files
+48 −14 .github/workflows/analyze.yml
+225 −169 .github/workflows/cmake.yml
+41 −0 .github/workflows/codeql.yml
+23 −38 .github/workflows/configure.yml
+0 −23 .github/workflows/fuzz.yml
+22 −17 .github/workflows/libpng.yml
+38 −18 .github/workflows/nmake.yml
+54 −34 .github/workflows/pigz.yml
+33 −26 .github/workflows/pkgcheck.yml
+13 −10 .github/workflows/release.yml
+66 −33 CMakeLists.txt
+21 −22 Makefile.in
+11 −3 PORTING.md
+3 −2 README.md
+3 −0 arch/arm/armfeature.c
+3 −8 arch/arm/chunkset_neon.c
+10 −24 arch/arm/crc32_acle.c
+8 −2 arch/s390/dfltcc_deflate.c
+103 −73 arch/s390/dfltcc_detail.h
+5 −3 arch/s390/dfltcc_inflate.c
+2 −0 arch/s390/self-hosted-builder/actions-runner.Dockerfile
+9 −8 arch/x86/chunkset_avx.c
+9 −8 arch/x86/chunkset_sse.c
+6 −42 chunkset.c
+4 −1 chunkset_tpl.h
+1 −1 cmake/detect-arch.c
+4 −4 cmake/detect-sanitizer.cmake
+14 −4 cmake/run-and-compare.cmake
+1 −1 cmake/test-compress.cmake
+3 −5 cmake/toolchain-aarch64.cmake
+9 −4 cmake/toolchain-arm.cmake
+25 −0 cmake/toolchain-armhf.cmake
+25 −6 cmake/toolchain-mingw-i686.cmake
+24 −6 cmake/toolchain-mingw-x86_64.cmake
+6 −6 cmake/toolchain-powerpc.cmake
+6 −6 cmake/toolchain-powerpc64.cmake
+6 −6 cmake/toolchain-powerpc64le.cmake
+5 −5 cmake/toolchain-s390x.cmake
+5 −5 cmake/toolchain-sparc64.cmake
+2 −0 compress.c
+45 −32 configure
+14 −8 deflate.c
+29 −49 deflate.h
+4 −0 fallback_builtins.h
+1 −10 gzguts.h
+0 −18 gzlib.c
+3 −5 gzread.c
+1 −1 gzwrite.c
+8 −6 infback.c
+13 −4 inflate.c
+1 −1 inftrees.c
+1 −0 test/CVE-2018-25032/default.txt
+1 −0 test/CVE-2018-25032/fixed.txt
+9 −2 test/Makefile.in
+2 −1 test/README.md
+12 −12 test/abicheck.sh
+1 −1 test/example.c
+39 −0 test/gh1235.c
+5 −0 test/infcover.c
+66 −19 test/minideflate.c
+15 −6 test/minigzip.c
+9 −1 test/pigz/CMakeLists.txt
+1 −1 test/pkgcheck.sh
+1 −1 tools/maketrees.c
+2 −2 trees.c
+0 −4 win32/zlib-ng1.rc
+0 −4 win32/zlib1.rc
+11 −0 zbuild.h
+0 −1 zconf-ng.h.in
+6 −2 zconf.h.in
+5 −3 zlib-ng.h
+0 −1 zlib-ng.map
+8 −5 zlib.h
+0 −1 zlib.map
+1 −1 zutil.c
+3 −1 zutil_p.h
4 changes: 2 additions & 2 deletions src/zlib_ng/zlib_ngmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
#include "stdbool.h"
#include "stdint.h"

#if defined(ZLIBNG_VERNUM) && ZLIBNG_VERNUM < 0x02060
#error "At least zlib-ng version 2.0.6 is required"
#if defined(ZLIBNG_VERNUM) && ZLIBNG_VERNUM < 0x02070
#error "At least zlib-ng version 2.0.7 is required"
#endif

#define ENTER_ZLIB(obj) do { \
Expand Down
28 changes: 3 additions & 25 deletions tests/test_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,7 @@ def test_adler32(data_size, value):
def test_compress(data_size, level, wbits):
data = DATA[:data_size]
compressed = zlib_ng.compress(data, level=level, wbits=wbits)
try:
decompressed = zlib.decompress(compressed, wbits)
except zlib.error:
# Known bug in zlib-ng 2.0.6. Wbits is not correctly applied for level 1.
if (zlib_ng.ZLIBNG_VERSION == "2.0.6" and
level == 1 and
wbits & 0b1111 < 13):
pytest.xfail()
decompressed = zlib.decompress(compressed, wbits)
assert decompressed == data


Expand Down Expand Up @@ -118,15 +111,7 @@ def test_decompress_wbits(data_size, level, wbits, memLevel, strategy):
def test_decompress_zlib_ng(data_size, level, wbits):
data = DATA[:data_size]
compressed = zlib_ng.compress(data, level=level, wbits=wbits)
try:
decompressed = zlib_ng.decompress(compressed, wbits=wbits)
except zlib_ng.error:
# Known bug in zlib-ng 2.0.6. Wbits is not correctly applied for level 1.
if (zlib_ng.ZLIBNG_VERSION == "2.0.6" and
level == 1 and
wbits & 0b1111 < 13):
pytest.xfail()
assert decompressed == data
decompressed = zlib_ng.decompress(compressed, wbits=wbits)
assert decompressed == data


Expand All @@ -139,14 +124,7 @@ def test_compress_compressobj(data_size, level, wbits, memLevel, strategy):
memLevel=memLevel,
strategy=strategy)
compressed = compressobj.compress(data) + compressobj.flush()
try:
decompressed = zlib.decompress(compressed, wbits=wbits)
except zlib.error:
# Known bug in zlib-ng 2.0.6. Wbits is not correctly applied for level 1.
if (zlib_ng.ZLIBNG_VERSION == "2.0.6" and
level == 1 and
wbits & 0b1111 < 13):
pytest.xfail()
decompressed = zlib.decompress(compressed, wbits=wbits)
assert data == decompressed


Expand Down
4 changes: 0 additions & 4 deletions tests/test_zlib_compliance.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,10 +835,6 @@ def test_large_unconsumed_tail(self, size):
finally:
comp = uncomp = data = None

# TODO: zlib-ng does not handle wbits for the zlib header correctly.
# TODO: latest zlib-ng works correctly. Should be fixed when new release
# TODO: of zlib-ng comes.
@unittest.expectedFailure
def test_wbits(self):
# wbits=0 only supported since zlib v1.2.3.5
# Register "1.2.3" as "1.2.3.0"
Expand Down