summaryrefslogtreecommitdiff
path: root/compress.c
diff options
context:
space:
mode:
authoralk3pInjection <webmaster@raspii.tech>2023-04-20 00:08:54 +0800
committeralk3pInjection <webmaster@raspii.tech>2023-04-20 00:08:54 +0800
commit004b98220a30de0d1956a8149d8bc6ec356667da (patch)
tree1eaee2603984d7ab4524be68b57ce0a2b2b72118 /compress.c
parent2ca0d0b38b60e8d6d49a8959bf674a79e7d16f41 (diff)
parenta583e215afa2356e23b418efa871a1cc4348702a (diff)
Merge tag '2.0.7' into tachibanatachibana-mr1tachibana
Change-Id: I7b03d60d67d184c21ff7437a35062077666951e9
Diffstat (limited to 'compress.c')
-rw-r--r--compress.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/compress.c b/compress.c
index fded2a4..1cf5d5f 100644
--- a/compress.c
+++ b/compress.c
@@ -92,6 +92,8 @@ z_size_t Z_EXPORT PREFIX(compressBound)(z_size_t sourceLen) {
#ifndef NO_QUICK_STRATEGY
return sourceLen /* The source size itself */
+ + (sourceLen == 0 ? 1 : 0) /* Always at least one byte for any input */
+ + (sourceLen < 9 ? 1 : 0) /* One extra byte for lengths less than 9 */
+ DEFLATE_QUICK_OVERHEAD(sourceLen) /* Source encoding overhead, padded to next full byte */
+ DEFLATE_BLOCK_OVERHEAD /* Deflate block overhead bytes */
+ ZLIB_WRAPLEN; /* zlib wrapper */