Blame SOURCES/unzip-zipbomb-part5.patch

a0bbf4
From 5c572555cf5d80309a07c30cf7a54b2501493720 Mon Sep 17 00:00:00 2001
a0bbf4
From: Mark Adler <madler@alumni.caltech.edu>
a0bbf4
Date: Sun, 9 Feb 2020 21:39:09 -0800
a0bbf4
Subject: [PATCH] Fix bug in UZinflate() that incorrectly updated G.incnt.
a0bbf4
a0bbf4
The update assumed a full buffer, which is not always full. This
a0bbf4
could result in a false overlapped element detection when a small
a0bbf4
deflate-compressed file was unzipped using an old zlib. This
a0bbf4
commit remedies that.
a0bbf4
---
a0bbf4
 inflate.c | 2 +-
a0bbf4
 1 file changed, 1 insertion(+), 1 deletion(-)
a0bbf4
a0bbf4
diff --git a/inflate.c b/inflate.c
a0bbf4
index 2f5a015..70e3cc0 100644
a0bbf4
--- a/inflate.c
a0bbf4
+++ b/inflate.c
a0bbf4
@@ -700,7 +700,7 @@ int UZinflate(__G__ is_defl64)
a0bbf4
       G.dstrm.total_out));
a0bbf4
 
a0bbf4
     G.inptr = (uch *)G.dstrm.next_in;
a0bbf4
-    G.incnt = (G.inbuf + INBUFSIZ) - G.inptr;  /* reset for other routines */
a0bbf4
+    G.incnt -= G.inptr - G.inbuf;       /* reset for other routines */
a0bbf4
 
a0bbf4
 uzinflate_cleanup_exit:
a0bbf4
     err = inflateReset(&G.dstrm);