xzyang / rpms / libxml2

Forked from rpms/libxml2 3 years ago
Clone

Blame SOURCES/libxml2-Fix-some-loop-issues-embedding-NEXT.patch

267d54
From 6dfc7fd442351269c421a525d91506e43e18208e Mon Sep 17 00:00:00 2001
267d54
From: Daniel Veillard <veillard@redhat.com>
267d54
Date: Fri, 20 Nov 2015 15:06:02 +0800
267d54
Subject: [PATCH] Fix some loop issues embedding NEXT
267d54
To: libvir-list@redhat.com
267d54
267d54
Next can switch the parser back to XML_PARSER_EOF state, we
267d54
need to consider those in loops consuming input
267d54
267d54
Signed-off-by: Daniel Veillard <veillard@redhat.com>
267d54
---
267d54
 parser.c | 6 ++++--
267d54
 1 file changed, 4 insertions(+), 2 deletions(-)
267d54
267d54
diff --git a/parser.c b/parser.c
267d54
index 7602498..cc45e17 100644
267d54
--- a/parser.c
267d54
+++ b/parser.c
267d54
@@ -2155,7 +2155,8 @@ xmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
267d54
 	int cur;
267d54
 	do {
267d54
 	    cur = CUR;
267d54
-	    while (IS_BLANK_CH(cur)) { /* CHECKED tstblanks.xml */
267d54
+	    while ((IS_BLANK_CH(cur) && /* CHECKED tstblanks.xml */
267d54
+	           (ctxt->instate != XML_PARSER_EOF))) {
267d54
 		NEXT;
267d54
 		cur = CUR;
267d54
 		res++;
267d54
@@ -2169,7 +2170,8 @@ xmlSkipBlankChars(xmlParserCtxtPtr ctxt) {
267d54
 	     * Need to handle support of entities branching here
267d54
 	     */
267d54
 	    if (*ctxt->input->cur == '%') xmlParserHandlePEReference(ctxt);
267d54
-	} while (IS_BLANK(cur)); /* CHECKED tstblanks.xml */
267d54
+	} while ((IS_BLANK(cur)) && /* CHECKED tstblanks.xml */
267d54
+	         (ctxt->instate != XML_PARSER_EOF));
267d54
     }
267d54
     return(res);
267d54
 }
267d54
-- 
267d54
2.5.0
267d54