summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/libxml/libxml2/CVE-2015-7499-1-Add-xmlHaltParser-to-stop-the-parser.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/libxml/libxml2/CVE-2015-7499-1-Add-xmlHaltParser-to-stop-the-parser.patch')
-rw-r--r--meta/recipes-core/libxml/libxml2/CVE-2015-7499-1-Add-xmlHaltParser-to-stop-the-parser.patch88
1 files changed, 88 insertions, 0 deletions
diff --git a/meta/recipes-core/libxml/libxml2/CVE-2015-7499-1-Add-xmlHaltParser-to-stop-the-parser.patch b/meta/recipes-core/libxml/libxml2/CVE-2015-7499-1-Add-xmlHaltParser-to-stop-the-parser.patch
new file mode 100644
index 0000000000..e39ec65cd9
--- /dev/null
+++ b/meta/recipes-core/libxml/libxml2/CVE-2015-7499-1-Add-xmlHaltParser-to-stop-the-parser.patch
@@ -0,0 +1,88 @@
1From 28cd9cb747a94483f4aea7f0968d202c20bb4cfc Mon Sep 17 00:00:00 2001
2From: Daniel Veillard <veillard@redhat.com>
3Date: Fri, 20 Nov 2015 14:55:30 +0800
4Subject: [PATCH] Add xmlHaltParser() to stop the parser
5
6The problem is doing it in a consistent and safe fashion
7It's more complex than just setting ctxt->instate = XML_PARSER_EOF
8Update the public function to reuse that new internal routine
9
10Upstream-Status: Backport
11
12CVE-2015-7499-1
13
14Signed-off-by: Armin Kuster <akuster@mvista.com>
15
16---
17 parser.c | 34 +++++++++++++++++++++++++++++-----
18 1 file changed, 29 insertions(+), 5 deletions(-)
19
20diff --git a/parser.c b/parser.c
21index da6e729..b6e99b1 100644
22--- a/parser.c
23+++ b/parser.c
24@@ -94,6 +94,8 @@ static xmlParserCtxtPtr
25 xmlCreateEntityParserCtxtInternal(const xmlChar *URL, const xmlChar *ID,
26 const xmlChar *base, xmlParserCtxtPtr pctx);
27
28+static void xmlHaltParser(xmlParserCtxtPtr ctxt);
29+
30 /************************************************************************
31 * *
32 * Arbitrary limits set in the parser. See XML_PARSE_HUGE *
33@@ -12625,25 +12627,47 @@ xmlCreatePushParserCtxt(xmlSAXHandlerPtr sax, void *user_data,
34 #endif /* LIBXML_PUSH_ENABLED */
35
36 /**
37- * xmlStopParser:
38+ * xmlHaltParser:
39 * @ctxt: an XML parser context
40 *
41- * Blocks further parser processing
42+ * Blocks further parser processing don't override error
43+ * for internal use
44 */
45-void
46-xmlStopParser(xmlParserCtxtPtr ctxt) {
47+static void
48+xmlHaltParser(xmlParserCtxtPtr ctxt) {
49 if (ctxt == NULL)
50 return;
51 ctxt->instate = XML_PARSER_EOF;
52- ctxt->errNo = XML_ERR_USER_STOP;
53 ctxt->disableSAX = 1;
54 if (ctxt->input != NULL) {
55+ /*
56+ * in case there was a specific allocation deallocate before
57+ * overriding base
58+ */
59+ if (ctxt->input->free != NULL) {
60+ ctxt->input->free((xmlChar *) ctxt->input->base);
61+ ctxt->input->free = NULL;
62+ }
63 ctxt->input->cur = BAD_CAST"";
64 ctxt->input->base = ctxt->input->cur;
65 }
66 }
67
68 /**
69+ * xmlStopParser:
70+ * @ctxt: an XML parser context
71+ *
72+ * Blocks further parser processing
73+ */
74+void
75+xmlStopParser(xmlParserCtxtPtr ctxt) {
76+ if (ctxt == NULL)
77+ return;
78+ xmlHaltParser(ctxt);
79+ ctxt->errNo = XML_ERR_USER_STOP;
80+}
81+
82+/**
83 * xmlCreateIOParserCtxt:
84 * @sax: a SAX handler
85 * @user_data: The user data returned on SAX callbacks
86--
872.3.5
88