zlib/zlib-1.2.13-fix-bug-deflateBound.patch
Danilo Spinella de997e08c9 Accepting request 1059548 from home:dspinella:branches:devel:libraries:c_c++
- Update to 1.13:
  * Fix configure issue that discarded provided CC definition
  * Correct incorrect inputs provided to the CRC functions
  * Repair prototypes and exporting of new CRC functions
  * Fix inflateBack to detect invalid input with distances too far
  * Have infback() deliver all of the available output up to any error
  * Fix a bug when getting a gzip header extra field with inflate()
  * Fix bug in block type selection when Z_FIXED used
  * Tighten deflateBound bounds
  * Remove deleted assembler code references
  * Various portability and appearance improvements
- Added patches:
  * zlib-1.2.13-IBM-Z-hw-accelerated-deflate-s390x.patch
  * zlib-1.2.13-fix-bug-deflateBound.patch
  * zlib-1.2.13-optimized-s390.patch
- Refreshed patches:
  * zlib-1.2.12-add-optimized-slide_hash-for-power.patch
  * zlib-1.2.12-add-vectorized-longest_match-for-power.patch
  * zlib-1.2.12-s390-vectorize-crc32.patch
- Removed patches:
  * zlib-1.2.12-fix-configure.patch
  * zlib-1.2.12-IBM-Z-hw-accelerated-deflate-s390x.patch
  * zlib-1.2.12-optimized-crc32-power8.patch
  * zlib-1.2.12-correct-inputs-provided-to-crc-func.patch
  * zlib-1.2.12-fix-CVE-2022-37434.patch
  * zlib-1.2.11-optimized-s390.patch

OBS-URL: https://build.opensuse.org/request/show/1059548
OBS-URL: https://build.opensuse.org/package/show/devel:libraries:c_c++/zlib?expand=0&rev=86
2023-01-19 11:29:57 +00:00

28 lines
1.1 KiB
Diff

From e554695638228b846d49657f31eeff0ca4680e8a Mon Sep 17 00:00:00 2001
From: Mark Adler <madler@alumni.caltech.edu>
Date: Thu, 15 Dec 2022 09:07:13 -0800
Subject: [PATCH] Fix bug in deflateBound() for level 0 and memLevel 9.
memLevel 9 would cause deflateBound() to assume the use of fixed
blocks, even if the compression level was 0, which forces stored
blocks. That could result in a bound less than the size of the
compressed data. Now level 0 always uses the stored blocks bound.
---
deflate.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/deflate.c b/deflate.c
index cd538b8ac..4a512e1f9 100644
--- a/deflate.c
+++ b/deflate.c
@@ -752,7 +752,8 @@ uLong ZEXPORT deflateBound(strm, sourceLen)
/* if not default parameters, return one of the conservative bounds */
if (s->w_bits != 15 || s->hash_bits != 8 + 7)
- return (s->w_bits <= s->hash_bits ? fixedlen : storelen) + wraplen;
+ return (s->w_bits <= s->hash_bits && s->level ? fixedlen : storelen) +
+ wraplen;
/* default settings: return tight bound for that case -- ~0.03% overhead
plus a small constant */