xzyang / rpms / libxml2

Forked from rpms/libxml2 3 years ago
Clone

Blame SOURCES/libxml2-Cleanup-conditional-section-error-handling.patch

6dedca
From 5b47a2c6666f0293a5164f094b9e8031914b1f8f Mon Sep 17 00:00:00 2001
6dedca
From: Daniel Veillard <veillard@redhat.com>
6dedca
Date: Mon, 23 Feb 2015 11:29:20 +0800
6dedca
Subject: [PATCH] Cleanup conditional section error handling
6dedca
To: libvir-list@redhat.com
6dedca
6dedca
For https://bugzilla.gnome.org/show_bug.cgi?id=744980
6dedca
6dedca
The error handling of Conditional Section also need to be
6dedca
straightened as the structure of the document can't be
6dedca
guessed on a failure there and it's better to stop parsing
6dedca
as further errors are likely to be irrelevant.
6dedca
6dedca
Signed-off-by: Daniel Veillard <veillard@redhat.com>
6dedca
---
6dedca
 parser.c | 6 ++++++
6dedca
 1 file changed, 6 insertions(+)
6dedca
6dedca
diff --git a/parser.c b/parser.c
6dedca
index d790f8e..dc14e5c 100644
6dedca
--- a/parser.c
6dedca
+++ b/parser.c
6dedca
@@ -6761,6 +6761,8 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
6dedca
 	SKIP_BLANKS;
6dedca
 	if (RAW != '[') {
6dedca
 	    xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
6dedca
+	    xmlStopParser(ctxt);
6dedca
+	    return;
6dedca
 	} else {
6dedca
 	    if (ctxt->input->id != id) {
6dedca
 		xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
6dedca
@@ -6821,6 +6823,8 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
6dedca
 	SKIP_BLANKS;
6dedca
 	if (RAW != '[') {
6dedca
 	    xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID, NULL);
6dedca
+	    xmlStopParser(ctxt);
6dedca
+	    return;
6dedca
 	} else {
6dedca
 	    if (ctxt->input->id != id) {
6dedca
 		xmlValidityError(ctxt, XML_ERR_ENTITY_BOUNDARY,
6dedca
@@ -6876,6 +6880,8 @@ xmlParseConditionalSections(xmlParserCtxtPtr ctxt) {
6dedca
 
6dedca
     } else {
6dedca
 	xmlFatalErr(ctxt, XML_ERR_CONDSEC_INVALID_KEYWORD, NULL);
6dedca
+	xmlStopParser(ctxt);
6dedca
+	return;
6dedca
     }
6dedca
 
6dedca
     if (RAW == 0)
6dedca
-- 
6dedca
2.5.0
6dedca