summaryrefslogtreecommitdiff
path: root/compress.c
diff options
context:
space:
mode:
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 */