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

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