master hovercats/oakiss / pkg / unzip / patch / 0015-fix-infinite-loop-when-extracting-empty-bzip2-data.patch
 1From e646271050da793fe50fe829b465c4e692fb7d53 Mon Sep 17 00:00:00 2001
 2From: Kamil Dudka <kdudka@redhat.com>
 3Date: Mon, 14 Sep 2015 18:24:56 +0200
 4Subject: [PATCH] fix infinite loop when extracting empty bzip2 data
 5
 6---
 7 extract.c | 6 ++++++
 8 1 file changed, 6 insertions(+)
 9
10diff --git a/extract.c b/extract.c
11index f951b9f..188f1cf 100644
12--- a/extract.c
13+++ b/extract.c
14@@ -2729,6 +2729,12 @@ __GDEF
15     int repeated_buf_err;
16     bz_stream bstrm;
17 
18+    if (G.incnt <= 0 && G.csize <= 0L) {
19+        /* avoid an infinite loop */
20+        Trace((stderr, "UZbunzip2() got empty input\n"));
21+        return 2;
22+    }
23+
24 #if (defined(DLL) && !defined(NO_SLIDE_REDIR))
25     if (G.redirect_slide)
26         wsize = G.redirect_size, redirSlide = G.redirect_buffer;
27-- 
282.20.1
29