]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Added CMake and CI configuration for INFLATE_STRICT and INFLATE_ALLOW_INVALID_DISTANC...
authorNathan Moinvaziri <nathan@solidstatenetworks.com>
Wed, 18 Mar 2020 02:14:59 +0000 (22:14 -0400)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sat, 2 May 2020 10:37:30 +0000 (12:37 +0200)
.github/workflows/cmake.yml
CMakeLists.txt
README.md

index 6ae7b717d8da755c156620c3be616e8c09016690..45d105e9a4138d4f48c1cacf7b302f30b9bc8867 100644 (file)
@@ -37,6 +37,8 @@ jobs:
           Ubuntu 18.04 GCC SPARC64 Compat,
           Ubuntu 18.04 GCC S390X Compat,
           Ubuntu 18.04 Clang,
+          Ubuntu 18.04 Clang Inflate Strict,
+          Ubuntu 18.04 Clang Inflate Allow Invalid Dist,
           Ubuntu 18.04 Clang Debug,
           Ubuntu 18.04 Clang MSAN,
           Windows 2019 MSVC Win32,
@@ -251,6 +253,22 @@ jobs:
             gcov-exec: llvm-cov-6.0 gcov
             codecov: ubuntu_clang
 
+          - name: Ubuntu 18.04 Clang Inflate Strict
+            os: ubuntu-18.04
+            compiler: clang
+            cmake-args: -DWITH_INFLATE_STRICT=ON
+            packages: llvm-6.0
+            gcov-exec: llvm-cov-6.0 gcov
+            codecov: ubuntu_clang_inflate_strict
+
+          - name: Ubuntu 18.04 Clang Inflate Allow Invalid Dist
+            os: ubuntu-18.04
+            compiler: clang
+            cmake-args: -DWITH_INFLATE_ALLOW_INVALID_DIST=ON
+            packages: llvm-6.0
+            gcov-exec: llvm-cov-6.0 gcov
+            codecov: ubuntu_clang_inflate_allow_invalid_dist
+
           - name: Ubuntu 18.04 Clang Debug
             os: ubuntu-18.04
             compiler: clang
index 32eb662c0af637c867c490bb25a918fac9cd0662..976238b64d8604bdf280c31c9aea6e8757b023db 100644 (file)
@@ -90,6 +90,8 @@ option(WITH_NATIVE_INSTRUCTIONS
     "Instruct the compiler to use the full instruction set on this host (gcc/clang -march=native)" OFF)
 option(WITH_MAINTAINER_WARNINGS "Build with project maintainer warnings" OFF)
 option(WITH_CODE_COVERAGE "Enable code coverage reporting" OFF)
+option(WITH_INFLATE_STRICT "Build with strict inflate distance checking" OFF)
+option(WITH_INFLATE_ALLOW_INVALID_DIST "Build with zero fill for inflate invalid distances" OFF)
 
 if(BASEARCH_ARM_FOUND)
     option(WITH_ACLE "Build with ACLE" ON)
@@ -105,7 +107,7 @@ elseif(BASEARCH_X86_FOUND)
 endif()
 
 mark_as_advanced(FORCE WITH_ACLE WITH_NEON WITH_DFLTCC_DEFLATE WITH_DFLTCC_INFLATE
-    WITH_AVX2 WITH_SSE2 WITH_SSE4 WITH_PCLMULQDQ)
+    WITH_AVX2 WITH_SSE2 WITH_SSE4 WITH_PCLMULQDQ WITH_INFLATE_STRICT WITH_INFLATE_ALLOW_INVALID_DIST)
 
 add_feature_info(ZLIB_COMPAT ZLIB_COMPAT "Provide a zlib-compatible API")
 add_feature_info(WITH_GZFILEOP WITH_GZFILEOP "Compile with support for gzFile-related functions")
@@ -586,6 +588,17 @@ endif()
 if(NOT WITH_NEW_STRATEGIES)
     add_definitions(-DNO_MEDIUM_STRATEGY)
 endif()
+#
+# Enable inflate compilation options
+#
+if(WITH_INFLATE_STRICT)
+    add_definitions(-DINFLATE_STRICT)
+    message(STATUS "Inflate strict distance checking enabled")
+endif()
+if(WITH_INFLATE_ALLOW_INVALID_DIST)
+    add_definitions(-DINFLATE_ALLOW_INVALID_DISTANCE_TOOFAR_ARRR)
+    message(STATUS "Inflate zero data for invalid distances enabled")
+endif()
 
 #
 # Macro to add either the given intrinsics option to the global compiler options,
index e01e5ba5af39431cbf510d2b3e247bd8bb0fa136..cd5bebf29f5b28698a2eaea19ae8190470509807 100644 (file)
--- a/README.md
+++ b/README.md
@@ -84,6 +84,7 @@ make test
 
 Build Options
 -------------
+
 | CMake                    | configure                | Description                                                                                  | Default |
 |:-------------------------|:-------------------------|:---------------------------------------------------------------------------------------------|---------|
 | ZLIB_COMPAT              | --zlib-compat            | Compile with zlib compatible API                                                             | OFF     |
@@ -164,18 +165,21 @@ and Mark Adler (decompression).
 
 Advanced Build Options
 ----------------------
-| CMake               | configure             | Description                                                         | Default                |
-|:--------------------|:----------------------|:--------------------------------------------------------------------|------------------------|
-| UNALIGNED_OK        |                       | Allow unaligned reads                                               | ON (x86, arm)          |
-|                     | --force-sse2          | Assume SSE2 instructions are always available                       | ON (x86), OFF (x86_64) |
-| WITH_AVX2           |                       | Build with AVX2 intrinsics                                          | ON                     |
-| WITH_SSE2           |                       | Build with SSE2 intrinsics                                          | ON                     |
-| WITH_SSE4           |                       | Build with SSE4 intrinsics                                          | ON                     |
-| WITH_PCLMULQDQ      |                       | Build with PCLMULQDQ intrinsics                                     | ON                     |
-| WITH_ACLE           | --without-acle        | Build with ACLE intrinsics                                          | ON                     |
-| WITH_NEON           | --without-neon        | Build with NEON intrinsics                                          | ON                     |
-| WITH_DFLTCC_DEFLATE | --with-dfltcc-deflate | Use DEFLATE COMPRESSION CALL instruction for compression on IBM Z   | OFF                    |
-| WITH_DFLTCC_INFLATE | --with-dfltcc-inflate | Use DEFLATE COMPRESSION CALL instruction for decompression on IBM Z | OFF                    |
+
+| CMake                           | configure             | Description                                                         | Default                |
+|:--------------------------------|:----------------------|:--------------------------------------------------------------------|------------------------|
+| UNALIGNED_OK                    |                       | Allow unaligned reads                                               | ON (x86, arm)          |
+|                                 | --force-sse2          | Assume SSE2 instructions are always available                       | ON (x86), OFF (x86_64) |
+| WITH_AVX2                       |                       | Build with AVX2 intrinsics                                          | ON                     |
+| WITH_SSE2                       |                       | Build with SSE2 intrinsics                                          | ON                     |
+| WITH_SSE4                       |                       | Build with SSE4 intrinsics                                          | ON                     |
+| WITH_PCLMULQDQ                  |                       | Build with PCLMULQDQ intrinsics                                     | ON                     |
+| WITH_ACLE                       | --without-acle        | Build with ACLE intrinsics                                          | ON                     |
+| WITH_NEON                       | --without-neon        | Build with NEON intrinsics                                          | ON                     |
+| WITH_DFLTCC_DEFLATE             | --with-dfltcc-deflate | Use DEFLATE COMPRESSION CALL instruction for compression on IBM Z   | OFF                    |
+| WITH_DFLTCC_INFLATE             | --with-dfltcc-inflate | Use DEFLATE COMPRESSION CALL instruction for decompression on IBM Z | OFF                    |
+| WITH_INFLATE_STRICT             |                       | Build with strict inflate distance checking                         | OFF                    |
+| WITH_INFLATE_ALLOW_INVALID_DIST |                       | Build with zero fill for inflate invalid distances                  | OFF                    |
 
 Contents
 --------