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