Fix bug when using gzflush() with a very small buffer.

This commit is contained in:
Mark Adler 2023-08-14 17:01:54 -07:00
parent 6951bc609b
commit d982514782

View File

@ -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;
}