summaryrefslogtreecommitdiff
path: root/backport-Fix-bug-when-using-gzflush-with-a-very-small-buffer.patch
diff options
context:
space:
mode:
Diffstat (limited to 'backport-Fix-bug-when-using-gzflush-with-a-very-small-buffer.patch')
-rw-r--r--backport-Fix-bug-when-using-gzflush-with-a-very-small-buffer.patch26
1 files changed, 26 insertions, 0 deletions
diff --git a/backport-Fix-bug-when-using-gzflush-with-a-very-small-buffer.patch b/backport-Fix-bug-when-using-gzflush-with-a-very-small-buffer.patch
new file mode 100644
index 0000000..047c17d
--- /dev/null
+++ b/backport-Fix-bug-when-using-gzflush-with-a-very-small-buffer.patch
@@ -0,0 +1,26 @@
+From d98251478246c8ef2f405d76e4ef1678c14d7eda Mon Sep 17 00:00:00 2001
+From: Mark Adler <madler@alumni.caltech.edu>
+Date: Mon, 14 Aug 2023 17:01:54 -0700
+Subject: [PATCH] Fix bug when using gzflush() with a very small buffer.
+
+Reference:https://github.com/madler/zlib/commit/d98251478246c8ef2f405d76e4ef1678c14d7eda
+Conflict:NA
+---
+ gzlib.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/gzlib.c b/gzlib.c
+index 2b446c448..29fc4486f 100644
+--- a/gzlib.c
++++ b/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;
+ }