Skip to content

Commit 5bff4bb

Browse files
committed
pull in upstream libxml2 patches
based on USN-3739-1 and -2. see related #1785.
1 parent c232226 commit 5bff4bb

4 files changed

Lines changed: 111 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# 1.8.5 / unreleased
22

3+
## Security Notes
4+
5+
[MRI] Pulled in upstream patches from libxml2 that address CVE-2018-14404 and CVE-2018-14567. Full details are available in #1785. Note that these patches are not yet (as of 2018-08-15) in an upstream release of libxml2.
6+
7+
38
## Bug fixes
49

510
* [MRI] Fix regression in installation when building against system libraries, where some systems would not be able to find libxml2 or libxslt when present. (Regression introduced in v1.8.3.) [#1722]

Manifest.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,8 @@ lib/xercesImpl.jar
251251
lib/xml-apis.jar
252252
lib/xsd/xmlparser/nokogiri.rb
253253
patches/libxml2/0001-Revert-Do-not-URI-escape-in-server-side-includes.patch
254+
patches/libxml2/0002-Fix-nullptr-deref-with-XPath-logic-ops.patch
255+
patches/libxml2/0003-Fix-infinite-loop-in-LZMA-decompression.patch
254256
patches/sort-patches-by-date
255257
suppressions/README.txt
256258
suppressions/nokogiri_ruby-2.supp
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
From a436374994c47b12d5de1b8b1d191a098fa23594 Mon Sep 17 00:00:00 2001
2+
From: Nick Wellnhofer <wellnhofer@aevum.de>
3+
Date: Mon, 30 Jul 2018 12:54:38 +0200
4+
Subject: [PATCH] Fix nullptr deref with XPath logic ops
5+
6+
If the XPath stack is corrupted, for example by a misbehaving extension
7+
function, the "and" and "or" XPath operators could dereference NULL
8+
pointers. Check that the XPath stack isn't empty and optimize the
9+
logic operators slightly.
10+
11+
Closes: https://gitlab.gnome.org/GNOME/libxml2/issues/5
12+
13+
Also see
14+
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=901817
15+
https://bugzilla.redhat.com/show_bug.cgi?id=1595985
16+
17+
This is CVE-2018-14404.
18+
19+
Thanks to Guy Inbar for the report.
20+
---
21+
xpath.c | 10 ++++------
22+
1 file changed, 4 insertions(+), 6 deletions(-)
23+
24+
diff --git a/xpath.c b/xpath.c
25+
index 3fae0bf..5e3bb9f 100644
26+
--- a/xpath.c
27+
+++ b/xpath.c
28+
@@ -13234,9 +13234,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
29+
return(0);
30+
}
31+
xmlXPathBooleanFunction(ctxt, 1);
32+
- arg1 = valuePop(ctxt);
33+
- arg1->boolval &= arg2->boolval;
34+
- valuePush(ctxt, arg1);
35+
+ if (ctxt->value != NULL)
36+
+ ctxt->value->boolval &= arg2->boolval;
37+
xmlXPathReleaseObject(ctxt->context, arg2);
38+
return (total);
39+
case XPATH_OP_OR:
40+
@@ -13252,9 +13251,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
41+
return(0);
42+
}
43+
xmlXPathBooleanFunction(ctxt, 1);
44+
- arg1 = valuePop(ctxt);
45+
- arg1->boolval |= arg2->boolval;
46+
- valuePush(ctxt, arg1);
47+
+ if (ctxt->value != NULL)
48+
+ ctxt->value->boolval |= arg2->boolval;
49+
xmlXPathReleaseObject(ctxt->context, arg2);
50+
return (total);
51+
case XPATH_OP_EQUAL:
52+
--
53+
2.17.1
54+
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
From 2240fbf5912054af025fb6e01e26375100275e74 Mon Sep 17 00:00:00 2001
2+
From: Nick Wellnhofer <wellnhofer@aevum.de>
3+
Date: Mon, 30 Jul 2018 13:14:11 +0200
4+
Subject: [PATCH] Fix infinite loop in LZMA decompression
5+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=UTF-8
7+
Content-Transfer-Encoding: 8bit
8+
9+
Check the liblzma error code more thoroughly to avoid infinite loops.
10+
11+
Closes: https://gitlab.gnome.org/GNOME/libxml2/issues/13
12+
Closes: https://bugzilla.gnome.org/show_bug.cgi?id=794914
13+
14+
This is CVE-2018-9251 and CVE-2018-14567.
15+
16+
Thanks to Dongliang Mu and Simon Wörner for the reports.
17+
---
18+
xzlib.c | 9 +++++++++
19+
1 file changed, 9 insertions(+)
20+
21+
diff --git a/xzlib.c b/xzlib.c
22+
index a839169..0ba88cf 100644
23+
--- a/xzlib.c
24+
+++ b/xzlib.c
25+
@@ -562,6 +562,10 @@ xz_decomp(xz_statep state)
26+
"internal error: inflate stream corrupt");
27+
return -1;
28+
}
29+
+ /*
30+
+ * FIXME: Remapping a couple of error codes and falling through
31+
+ * to the LZMA error handling looks fragile.
32+
+ */
33+
if (ret == Z_MEM_ERROR)
34+
ret = LZMA_MEM_ERROR;
35+
if (ret == Z_DATA_ERROR)
36+
@@ -587,6 +591,11 @@ xz_decomp(xz_statep state)
37+
xz_error(state, LZMA_PROG_ERROR, "compression error");
38+
return -1;
39+
}
40+
+ if ((state->how != GZIP) &&
41+
+ (ret != LZMA_OK) && (ret != LZMA_STREAM_END)) {
42+
+ xz_error(state, ret, "lzma error");
43+
+ return -1;
44+
+ }
45+
} while (strm->avail_out && ret != LZMA_STREAM_END);
46+
47+
/* update available output and crc check value */
48+
--
49+
2.17.1
50+

0 commit comments

Comments
 (0)