master hovercats/oakiss / pkg / unzip / patch / 0022-Fix-bug-in-undefer_input-that-misplaced-the-input-st.patch
 1From 3eda39fac98550990abb9f83d986619d173f9605 Mon Sep 17 00:00:00 2001
 2From: Mark Adler <madler@alumni.caltech.edu>
 3Date: Fri, 31 Jan 2020 22:05:56 -0800
 4Subject: [PATCH] Fix bug in undefer_input() that misplaced the input state.
 5
 6    Fix bug in undefer_input() that misplaced the input state.
 7---
 8 fileio.c | 4 +++-
 9 1 file changed, 3 insertions(+), 1 deletion(-)
10
11diff --git a/fileio.c b/fileio.c
12index c10ff63..6290824 100644
13--- a/fileio.c
14+++ b/fileio.c
15@@ -532,8 +532,10 @@ void undefer_input(__G)
16          * This condition was checked when G.incnt_leftover was set > 0 in
17          * defer_leftover_input(), and it is NOT allowed to touch G.csize
18          * before calling undefer_input() when (G.incnt_leftover > 0)
19-         * (single exception: see read_byte()'s  "G.csize <= 0" handling) !!
20+         * (single exception: see readbyte()'s  "G.csize <= 0" handling) !!
21          */
22+        if (G.csize < 0L)
23+            G.csize = 0L;
24         G.incnt = G.incnt_leftover + (int)G.csize;
25         G.inptr = G.inptr_leftover - (int)G.csize;
26         G.incnt_leftover = 0;
27-- 
282.25.0
29