1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-28 22:50:07 +03:00

Make sure the parser returns when getting a Stop order

patch backported from chromiun bug fixes, assuming author is Chris
This commit is contained in:
Chris Evans 2011-12-14 16:18:25 +08:00 committed by Daniel Veillard
parent cb3549e30a
commit 77404b8b69

View File

@ -4949,7 +4949,8 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
(ctxt->sax->processingInstruction != NULL))
ctxt->sax->processingInstruction(ctxt->userData,
target, NULL);
ctxt->instate = state;
if (ctxt->instate != XML_PARSER_EOF)
ctxt->instate = state;
return;
}
buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
@ -5029,7 +5030,8 @@ xmlParsePI(xmlParserCtxtPtr ctxt) {
} else {
xmlFatalErr(ctxt, XML_ERR_PI_NOT_STARTED, NULL);
}
ctxt->instate = state;
if (ctxt->instate != XML_PARSER_EOF)
ctxt->instate = state;
}
}
@ -9589,6 +9591,8 @@ xmlParseElement(xmlParserCtxtPtr ctxt) {
else
name = xmlParseStartTag(ctxt);
#endif /* LIBXML_SAX1_ENABLED */
if (ctxt->instate == XML_PARSER_EOF)
return;
if (name == NULL) {
spacePop(ctxt);
return;
@ -10975,6 +10979,8 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
else
name = xmlParseStartTag(ctxt);
#endif /* LIBXML_SAX1_ENABLED */
if (ctxt->instate == XML_PARSER_EOF)
goto done;
if (name == NULL) {
spacePop(ctxt);
ctxt->instate = XML_PARSER_EOF;
@ -11161,7 +11167,9 @@ xmlParseTryOrFinish(xmlParserCtxtPtr ctxt, int terminate) {
else
xmlParseEndTag1(ctxt, 0);
#endif /* LIBXML_SAX1_ENABLED */
if (ctxt->nameNr == 0) {
if (ctxt->instate == XML_PARSER_EOF) {
/* Nothing */
} else if (ctxt->nameNr == 0) {
ctxt->instate = XML_PARSER_EPILOG;
} else {
ctxt->instate = XML_PARSER_CONTENT;