]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Fix bug when using gzflush() with a very small buffer.
authorMark Adler <madler@alumni.caltech.edu>
Mon, 21 Aug 2023 20:49:50 +0000 (13:49 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Thu, 24 Aug 2023 09:22:33 +0000 (11:22 +0200)
gzlib.c

diff --git a/gzlib.c b/gzlib.c
index e1290fc611aa4ced73cae4ef126763d3e3b3e8c8..e613837efb52ecad7e13eda4eb6d8c49ac7cafc6 100644 (file)
--- a/gzlib.c
+++ b/gzlib.c
@@ -274,8 +274,8 @@ int Z_EXPORT PREFIX(gzbuffer)(gzFile file, unsigned size) {
     /* check and set requested size */
     if ((size << 1) < size)
         return -1;              /* need to be able to double it */
-    if (size < 2)
-        size = 2;               /* need two bytes to check magic header */
+    if (size < 8)
+        size = 8;               /* needed to behave well with flushing */
     state->want = size;
     return 0;
 }