Blame SOURCES/libxml2-2.9.1-CVE-2018-14567.patch

8a784f
From 2240fbf5912054af025fb6e01e26375100275e74 Mon Sep 17 00:00:00 2001
8a784f
From: Nick Wellnhofer <wellnhofer@aevum.de>
8a784f
Date: Mon, 30 Jul 2018 13:14:11 +0200
8a784f
Subject: [PATCH] Fix infinite loop in LZMA decompression
8a784f
MIME-Version: 1.0
8a784f
Content-Type: text/plain; charset=UTF-8
8a784f
Content-Transfer-Encoding: 8bit
8a784f
8a784f
Check the liblzma error code more thoroughly to avoid infinite loops.
8a784f
8a784f
Closes: https://gitlab.gnome.org/GNOME/libxml2/issues/13
8a784f
Closes: https://bugzilla.gnome.org/show_bug.cgi?id=794914
8a784f
8a784f
This is CVE-2018-9251 and CVE-2018-14567.
8a784f
8a784f
Thanks to Dongliang Mu and Simon Wörner for the reports.
8a784f
---
8a784f
 xzlib.c | 9 +++++++++
8a784f
 1 file changed, 9 insertions(+)
8a784f
8a784f
diff --git a/xzlib.c b/xzlib.c
8a784f
index a839169e..0ba88cfa 100644
8a784f
--- a/xzlib.c
8a784f
+++ b/xzlib.c
8a784f
@@ -562,6 +562,10 @@ xz_decomp(xz_statep state)
8a784f
                          "internal error: inflate stream corrupt");
8a784f
                 return -1;
8a784f
             }
8a784f
+            /*
8a784f
+             * FIXME: Remapping a couple of error codes and falling through
8a784f
+             * to the LZMA error handling looks fragile.
8a784f
+             */
8a784f
             if (ret == Z_MEM_ERROR)
8a784f
                 ret = LZMA_MEM_ERROR;
8a784f
             if (ret == Z_DATA_ERROR)
8a784f
@@ -587,6 +591,11 @@ xz_decomp(xz_statep state)
8a784f
             xz_error(state, LZMA_PROG_ERROR, "compression error");
8a784f
             return -1;
8a784f
         }
8a784f
+        if ((state->how != GZIP) &&
8a784f
+            (ret != LZMA_OK) && (ret != LZMA_STREAM_END)) {
8a784f
+            xz_error(state, ret, "lzma error");
8a784f
+            return -1;
8a784f
+        }
8a784f
     } while (strm->avail_out && ret != LZMA_STREAM_END);
8a784f
 
8a784f
     /* update available output and crc check value */
8a784f
-- 
8a784f
2.22.0
8a784f