Skip to content

Commit a615b08

Browse files
hongxu-jiarpurdie
authored andcommitted
libxml2: Fix CVE-2017-8872
fix global-buffer-overflow in htmlParseTryOrFinish (HTMLparser.c:5403) https://bugzilla.gnome.org/show_bug.cgi?id=775200 Here is the reproduce steps on ubuntu 16.04, use clang with "-fsanitize=address" ... export CC="clang" export CFLAGS="-fsanitize=address" ./configure --disable-shared make clean all -j wget https://bugzilla.gnome.org/attachment.cgi?id=340871 -O poc ./xmllint --html --push poc ==2785==ERROR: AddressSanitizer: global-buffer-overflow on address 0x000000a0de21 at pc 0x0000006a7f6e bp 0x7ffdfe940c10 sp 0x7ffdfe940c08 READ of size 1 at 0x000000a0de21 thread T0 #0 0x6a7f6d (/home/jiahongxu/Downloads/libxml2-2.9.4/xmllint+0x6a7f6d) #1 0x6a7356 (/home/jiahongxu/Downloads/libxml2-2.9.4/xmllint+0x6a7356) #2 0x4f4504 (/home/jiahongxu/Downloads/libxml2-2.9.4/xmllint+0x4f4504) #3 0x4f045e (/home/jiahongxu/Downloads/libxml2-2.9.4/xmllint+0x4f045e) #4 0x7f81977d682f (/lib/x86_64-linux-gnu/libc.so.6+0x2082f) #5 0x419ad8 (/home/jiahongxu/Downloads/libxml2-2.9.4/xmllint+0x419ad8) ... Signed-off-by: Hongxu Jia <[email protected]> Signed-off-by: Richard Purdie <[email protected]>
1 parent 24ac12e commit a615b08

2 files changed

Lines changed: 38 additions & 0 deletions

File tree

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
From d2f873a541c72b0f67e15562819bf98b884b30b7 Mon Sep 17 00:00:00 2001
2+
From: Hongxu Jia <[email protected]>
3+
Date: Wed, 23 Aug 2017 16:04:49 +0800
4+
Subject: [PATCH] fix CVE-2017-8872
5+
6+
this makes xmlHaltParser "empty" the buffer, as it resets cur and ava
7+
il too here.
8+
9+
this seems to cure this specific issue, and also passes the testsuite
10+
11+
Signed-off-by: Marcus Meissner <[email protected]>
12+
13+
https://bugzilla.gnome.org/show_bug.cgi?id=775200
14+
Upstream-Status: Backport [https://bugzilla.gnome.org/attachment.cgi?id=355527&action=diff]
15+
Signed-off-by: Hongxu Jia <[email protected]>
16+
---
17+
parser.c | 4 ++++
18+
1 file changed, 4 insertions(+)
19+
20+
diff --git a/parser.c b/parser.c
21+
index 9506ead..6c07ffd 100644
22+
--- a/parser.c
23+
+++ b/parser.c
24+
@@ -12664,6 +12664,10 @@ xmlHaltParser(xmlParserCtxtPtr ctxt) {
25+
}
26+
ctxt->input->cur = BAD_CAST"";
27+
ctxt->input->base = ctxt->input->cur;
28+
+ if (ctxt->input->buf) {
29+
+ xmlBufEmpty (ctxt->input->buf->buffer);
30+
+ } else
31+
+ ctxt->input->length = 0;
32+
}
33+
}
34+
35+
--
36+
2.7.4
37+

meta/recipes-core/libxml/libxml2_2.9.4.bb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ SRC_URI = "ftp://xmlsoft.org/libxml2/libxml2-${PV}.tar.gz;name=libtar \
2828
file://libxml2-CVE-2017-9049_CVE-2017-9050.patch \
2929
file://libxml2-CVE-2017-5969.patch \
3030
file://libxml2-CVE-2017-0663.patch \
31+
file://libxml2-CVE-2017-8872.patch \
3132
file://0001-Make-ptest-run-the-python-tests-if-python-is-enabled.patch \
3233
"
3334

0 commit comments

Comments
 (0)