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

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