summaryrefslogtreecommitdiff
path: root/pkg/unzip/patch/0025-Fix-bug-in-UZbunzip2-that-incorrectly-updated-G.incn.patch
blob: 2c6514595a998a2988d1f23ad931e342a2405c74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From 705923de022bad2ce0142ccbab68aa57ebe36db1 Mon Sep 17 00:00:00 2001
From: Mark Adler <madler@alumni.caltech.edu>
Date: Mon, 28 Apr 2025 12:57:34 -0700
Subject: [PATCH] Fix bug in UZbunzip2() that incorrectly updated G.incnt

    Fix bug in UZbunzip2() that incorrectly updated G.incnt.

    The update assumed a full buffer, which is not always full. This
    could result in a false overlapped element detection when a small
    bzip2-compressed file was unzipped. This commit remedies that.
---
 extract.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/extract.c b/extract.c
index ad5daac..6712ed0 100644
--- a/extract.c
+++ b/extract.c
@@ -3052,7 +3052,7 @@ __GDEF
 #endif
 
     G.inptr = (uch *)bstrm.next_in;
-    G.incnt = (G.inbuf + INBUFSIZ) - G.inptr;  /* reset for other routines */
+    G.incnt -= G.inptr - G.inbuf;       /* reset for other routines */
 
 uzbunzip_cleanup_exit:
     err = BZ2_bzDecompressEnd(&bstrm);
-- 
2.45.2