Gentoo Archives: gentoo-commits

From: Mike Frysinger <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-libs/libxml2/, dev-libs/libxml2/files/
Date: Thu, 03 Jan 2019 11:22:10
Message-Id: 1546514506.3e81bfb6899b407dba3dca6aa76f4cd2a30d6dd7.vapier@gentoo
1 commit: 3e81bfb6899b407dba3dca6aa76f4cd2a30d6dd7
2 Author: Xiaoyong Zhou <xzhou <AT> google <DOT> com>
3 AuthorDate: Tue Dec 4 22:53:14 2018 +0000
4 Commit: Mike Frysinger <vapier <AT> gentoo <DOT> org>
5 CommitDate: Thu Jan 3 11:21:46 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3e81bfb6
7
8 dev-libs/libxml2: fix CVE-2018-14404
9
10 Signed-off-by: Xiaoyong Zhou <xzhou <AT> google.com>
11 Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>
12
13 .../files/libxml2-2.9.8-CVE-2018-14404.patch | 54 ++++++++++++++++++++++
14 dev-libs/libxml2/libxml2-2.9.8-r1.ebuild | 4 ++
15 2 files changed, 58 insertions(+)
16
17 diff --git a/dev-libs/libxml2/files/libxml2-2.9.8-CVE-2018-14404.patch b/dev-libs/libxml2/files/libxml2-2.9.8-CVE-2018-14404.patch
18 new file mode 100644
19 index 00000000000..59bfc0fa9b8
20 --- /dev/null
21 +++ b/dev-libs/libxml2/files/libxml2-2.9.8-CVE-2018-14404.patch
22 @@ -0,0 +1,54 @@
23 +From a436374994c47b12d5de1b8b1d191a098fa23594 Mon Sep 17 00:00:00 2001
24 +From: Nick Wellnhofer <wellnhofer@×××××.de>
25 +Date: Mon, 30 Jul 2018 12:54:38 +0200
26 +Subject: [PATCH] Fix nullptr deref with XPath logic ops
27 +
28 +If the XPath stack is corrupted, for example by a misbehaving extension
29 +function, the "and" and "or" XPath operators could dereference NULL
30 +pointers. Check that the XPath stack isn't empty and optimize the
31 +logic operators slightly.
32 +
33 +Closes: https://gitlab.gnome.org/GNOME/libxml2/issues/5
34 +
35 +Also see
36 +https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=901817
37 +https://bugzilla.redhat.com/show_bug.cgi?id=1595985
38 +
39 +This is CVE-2018-14404.
40 +
41 +Thanks to Guy Inbar for the report.
42 +---
43 + xpath.c | 10 ++++------
44 + 1 file changed, 4 insertions(+), 6 deletions(-)
45 +
46 +diff --git a/xpath.c b/xpath.c
47 +index 3fae0bf4e0a0..5e3bb9ff6401 100644
48 +--- a/xpath.c
49 ++++ b/xpath.c
50 +@@ -13234,9 +13234,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
51 + return(0);
52 + }
53 + xmlXPathBooleanFunction(ctxt, 1);
54 +- arg1 = valuePop(ctxt);
55 +- arg1->boolval &= arg2->boolval;
56 +- valuePush(ctxt, arg1);
57 ++ if (ctxt->value != NULL)
58 ++ ctxt->value->boolval &= arg2->boolval;
59 + xmlXPathReleaseObject(ctxt->context, arg2);
60 + return (total);
61 + case XPATH_OP_OR:
62 +@@ -13252,9 +13251,8 @@ xmlXPathCompOpEval(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op)
63 + return(0);
64 + }
65 + xmlXPathBooleanFunction(ctxt, 1);
66 +- arg1 = valuePop(ctxt);
67 +- arg1->boolval |= arg2->boolval;
68 +- valuePush(ctxt, arg1);
69 ++ if (ctxt->value != NULL)
70 ++ ctxt->value->boolval |= arg2->boolval;
71 + xmlXPathReleaseObject(ctxt->context, arg2);
72 + return (total);
73 + case XPATH_OP_EQUAL:
74 +--
75 +2.19.1
76 +
77
78 diff --git a/dev-libs/libxml2/libxml2-2.9.8-r1.ebuild b/dev-libs/libxml2/libxml2-2.9.8-r1.ebuild
79 index 43da94cafed..86521ab289a 100644
80 --- a/dev-libs/libxml2/libxml2-2.9.8-r1.ebuild
81 +++ b/dev-libs/libxml2/libxml2-2.9.8-r1.ebuild
82 @@ -92,6 +92,10 @@ src_prepare() {
83 # https://bugzilla.gnome.org/show_bug.cgi?id=794914
84 eapply "${FILESDIR}"/${PN}-2.9.8-CVE-2018-14567.patch
85
86 + # CVE-2018-14404
87 + # https://gitlab.gnome.org/GNOME/libxml2/issues/5
88 + eapply "${FILESDIR}"/${PN}-2.9.8-CVE-2018-14404.patch
89 +
90 if [[ ${CHOST} == *-darwin* ]] ; then
91 # Avoid final linking arguments for python modules
92 sed -i -e '/PYTHON_LIBS/s/ldflags/libs/' configure.ac || die