diff --git a/parser.c b/parser.c index 4006246e..98fb87cc 100644 --- a/parser.c +++ b/parser.c @@ -3350,6 +3350,8 @@ xmlParseName(xmlParserCtxtPtr ctxt) { XML_MAX_NAME_LENGTH; GROW; + if (ctxt->instate == XML_PARSER_EOF) + return(NULL); #ifdef DEBUG nbParseName++; @@ -3405,6 +3407,8 @@ xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) { * Handler for more complex cases */ GROW; + if (ctxt->instate == XML_PARSER_EOF) + return(NULL); startPosition = CUR_PTR - BASE_PTR; c = CUR_CHAR(l); if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */ @@ -3682,6 +3686,8 @@ xmlParseNmtoken(xmlParserCtxtPtr ctxt) { if (count++ > XML_PARSER_CHUNK_SIZE) { count = 0; GROW; + if (ctxt->instate == XML_PARSER_EOF) + return(NULL); } COPY_BUF(l,buf,len,c); NEXTL(l); @@ -8861,6 +8867,8 @@ xmlParseQName(xmlParserCtxtPtr ctxt, const xmlChar **prefix) { const xmlChar *l, *p; GROW; + if (ctxt->instate == XML_PARSER_EOF) + return(NULL); l = xmlParseNCName(ctxt); if (l == NULL) {