Patrick Williams | f1e5d69 | 2016-03-30 15:21:19 -0500 | [diff] [blame^] | 1 | From 9b8512337d14c8ddf662fcb98b0135f225a1c489 Mon Sep 17 00:00:00 2001 |
| 2 | From: Daniel Veillard <veillard@redhat.com> |
| 3 | Date: Mon, 23 Feb 2015 11:29:20 +0800 |
| 4 | Subject: [PATCH] Cleanup conditional section error handling |
| 5 | |
| 6 | For https://bugzilla.gnome.org/show_bug.cgi?id=744980 |
| 7 | |
| 8 | The error handling of Conditional Section also need to be |
| 9 | straightened as the structure of the document can't be |
| 10 | guessed on a failure there and it's better to stop parsing |
| 11 | as further errors are likely to be irrelevant. |
| 12 | |
| 13 | Upstream-Status: Backport |
| 14 | |
| 15 | CVE-2015-7941-2 |
| 16 | |
| 17 | Signed-off-by: Armin Kuster <akuster@mvista.com> |
| 18 | |
| 19 | --- |
| 20 | parser.c | 6 ++++++ |
| 21 | 1 file changed, 6 insertions(+) |
| 22 | |
| 23 | diff --git a/parser.c b/parser.c |
| 24 | index 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 | -- |
| 55 | 2.3.5 |
| 56 | |