Blame SOURCES/0004-Fix-buffer-overrun-when-generating-Huffman-codes.patch

7703fd
From 42a8b8af21af24bb35548bcd2499c792d1a8c1a3 Mon Sep 17 00:00:00 2001
7703fd
From: Richard Hughes <richard@hughsie.com>
7703fd
Date: Wed, 1 Mar 2017 17:15:10 +0000
7703fd
Subject: [PATCH 4/4] Fix buffer overrun when generating Huffman codes
7703fd
7703fd
---
7703fd
 libgcab/decomp.c | 4 +++-
7703fd
 1 file changed, 3 insertions(+), 1 deletion(-)
7703fd
7703fd
diff --git a/libgcab/decomp.c b/libgcab/decomp.c
7703fd
index 52445e8..3ee8f9b 100644
7703fd
--- a/libgcab/decomp.c
7703fd
+++ b/libgcab/decomp.c
7703fd
@@ -190,7 +190,9 @@ struct Ziphuft **t, cab_LONG *m, fdi_decomp_state *decomp_state)
7703fd
           xp = ZIP(c) + k;
7703fd
           while (++j < z)       /* try smaller tables up to z bits */
7703fd
           {
7703fd
-            if ((f <<= 1) <= *++xp)
7703fd
+            if (*++xp > ZIPBMAX)
7703fd
+              return 2;         /* corrupt */
7703fd
+            if ((f <<= 1) <= *xp)
7703fd
               break;            /* enough codes to use up j bits */
7703fd
             f -= *xp;           /* else deduct codes from patterns */
7703fd
           }
7703fd
-- 
7703fd
2.9.3
7703fd