xzyang / rpms / libxml2

Forked from rpms/libxml2 3 years ago
Clone

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

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