xzyang / rpms / libxml2

Forked from rpms/libxml2 3 years ago
Clone

Blame SOURCES/libxml2-Stop-parsing-on-entities-boundaries-errors.patch

6dedca
From f0dbfaebd1a4a647ed1902ca16839ecfcb89c422 Mon Sep 17 00:00:00 2001
6dedca
From: Daniel Veillard <veillard@redhat.com>
6dedca
Date: Mon, 23 Feb 2015 11:17:35 +0800
6dedca
Subject: [PATCH] Stop parsing on entities boundaries errors
6dedca
To: libvir-list@redhat.com
6dedca
6dedca
For https://bugzilla.gnome.org/show_bug.cgi?id=744980
6dedca
6dedca
There are times, like on unterminated entities that it's preferable to
6dedca
stop parsing, even if that means less error reporting. Entities are
6dedca
feeding the parser on further processing, and if they are ill defined
6dedca
then it's possible to get the parser to bug. Also do the same on
6dedca
Conditional Sections if the input is broken, as the structure of
6dedca
the document can't be guessed.
6dedca
6dedca
Signed-off-by: Daniel Veillard <veillard@redhat.com>
6dedca
---
6dedca
 parser.c | 1 +
6dedca
 1 file changed, 1 insertion(+)
6dedca
6dedca
diff --git a/parser.c b/parser.c
6dedca
index f70d2b5..d790f8e 100644
6dedca
--- a/parser.c
6dedca
+++ b/parser.c
6dedca
@@ -5649,6 +5649,7 @@ xmlParseEntityDecl(xmlParserCtxtPtr ctxt) {
6dedca
 	if (RAW != '>') {
6dedca
 	    xmlFatalErrMsgStr(ctxt, XML_ERR_ENTITY_NOT_FINISHED,
6dedca
 	            "xmlParseEntityDecl: entity %s not terminated\n", name);
6dedca
+	    xmlStopParser(ctxt);
6dedca
 	} else {
6dedca
 	    if (input != ctxt->input) {
6dedca
 		xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY,
6dedca
-- 
6dedca
2.5.0
6dedca