xzyang / rpms / libxml2

Forked from rpms/libxml2 3 years ago
Clone

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

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