1From 080d52c3c9416c731f637f9c6e003961ef43f079 Mon Sep 17 00:00:00 2001 2From: Mark Adler <madler@alumni.caltech.edu> 3Date: Mon, 27 May 2019 08:20:32 -0700 4Subject: [PATCH 1/3] Fix bug in undefer_input() that misplaced the input 5 state. 6 7CVE: CVE-2019-13232 8Upstream-Status: Backport 9[https://github.com/madler/unzip/commit/41beb477c5744bc396fa1162ee0c14218ec12213] 10 11Signed-off-by: Dan Tran <dantran@microsoft.com> 12--- 13 fileio.c | 4 +++- 14 1 file changed, 3 insertions(+), 1 deletion(-) 15 16diff --git a/fileio.c b/fileio.c 17index 7605a29..14460f3 100644 18--- a/fileio.c 19+++ b/fileio.c 20@@ -532,8 +532,10 @@ void undefer_input(__G) 21 * This condition was checked when G.incnt_leftover was set > 0 in 22 * defer_leftover_input(), and it is NOT allowed to touch G.csize 23 * before calling undefer_input() when (G.incnt_leftover > 0) 24- * (single exception: see read_byte()'s "G.csize <= 0" handling) !! 25+ * (single exception: see readbyte()'s "G.csize <= 0" handling) !! 26 */ 27+ if (G.csize < 0L) 28+ G.csize = 0L; 29 G.incnt = G.incnt_leftover + (int)G.csize; 30 G.inptr = G.inptr_leftover - (int)G.csize; 31 G.incnt_leftover = 0; 32-- 332.22.0.vfs.1.1.57.gbaf16c8 34