From b4d5016b5e42fec226d93fd13260b6cac80eb384 Mon Sep 17 00:00:00 2001 From: Marek Habersack Date: Fri, 25 Sep 2015 21:18:22 +0200 Subject: [PATCH] [support] Limit possible values Value returned from the reader function can be negative and ZStream's avail_in should not be less than 0 as that value makes no sense and other parts of code assume it to be equal or higher than 0. --- support/zlib-helper.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support/zlib-helper.c b/support/zlib-helper.c index 38696260a09..dbfd1c7e24a 100644 --- a/support/zlib-helper.c +++ b/support/zlib-helper.c @@ -187,7 +187,7 @@ ReadZStream (ZStream *stream, guchar *buffer, gint length) stream->eof = TRUE; } zs->next_in = stream->buffer; - zs->avail_in = n; + zs->avail_in = n < 0 ? 0 : n; } if (zs->avail_in == 0 && zs->total_in == 0) -- 2.25.1