]> git.lizzy.rs Git - zlib.git/blobdiff - gzlib.c
Improve speed of gzprintf() in transparent mode.
[zlib.git] / gzlib.c
diff --git a/gzlib.c b/gzlib.c
index ced2cb8ba74096377051f98892479ee95b537c73..3e344f93b30fd34053ce9b99aa7604a55acdccc2 100644 (file)
--- a/gzlib.c
+++ b/gzlib.c
@@ -331,6 +331,8 @@ int ZEXPORT gzbuffer(file, size)
         return -1;
 
     /* 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 */
     state->want = size;