blob: b7bd9605317077a5d3bb4dd719d07d93feefe745 [file] [log] [blame]
Patrick Williamsf1e5d692016-03-30 15:21:19 -05001From 9b8512337d14c8ddf662fcb98b0135f225a1c489 Mon Sep 17 00:00:00 2001
2From: Daniel Veillard <veillard@redhat.com>
3Date: Mon, 23 Feb 2015 11:29:20 +0800
4Subject: [PATCH] Cleanup conditional section error handling
5
6For https://bugzilla.gnome.org/show_bug.cgi?id=744980
7
8The error handling of Conditional Section also need to be
9straightened as the structure of the document can't be
10guessed on a failure there and it's better to stop parsing
11as further errors are likely to be irrelevant.
12
13Upstream-Status: Backport
14
15CVE-2015-7941-2
16
17Signed-off-by: Armin Kuster <akuster@mvista.com>
18
19---
20 parser.c | 6 ++++++
21 1 file changed, 6 insertions(+)
22
23diff --git a/parser.c b/parser.c
24index bbe97eb..fe603ac 100644
25--- a/parser.c
26+++ b/parser.c
27@@ -6770,6 +6770,8 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
28 SKIP_BLANKS;
29 if (RAW != '[') {
30 xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
31+ xmlStopParser(ctxt);
32+ return;
33 } else {
34 if (ctxt->input->id != id) {
35 xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
36@@ -6830,6 +6832,8 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
37 SKIP_BLANKS;
38 if (RAW != '[') {
39 xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
40+ xmlStopParser(ctxt);
41+ return;
42 } else {
43 if (ctxt->input->id != id) {
44 xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
45@@ -6885,6 +6889,8 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
46
47 } else {
48 xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID_KEYWORD, NULL);
49+ xmlStopParser(ctxt);
50+ return;
51 }
52
53 if (RAW == 0)
54--
552.3.5
56