From cb4f93b0b373fb30800b379faf83e7f3d5d26f4c Mon Sep 17 00:00:00 2001 From: tb Date: Tue, 15 Aug 2023 12:18:46 +0000 Subject: [PATCH] Fix bug when using gzflush() with a very small buffer. from upstream --- lib/libz/gzlib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libz/gzlib.c b/lib/libz/gzlib.c index 2b446c448f0..29fc4486fba 100644 --- a/lib/libz/gzlib.c +++ b/lib/libz/gzlib.c @@ -308,8 +308,8 @@ int ZEXPORT 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; } -- 2.20.1