diff options
author | Chris Evans <scarybeasts@gmail.com> | 2011-12-14 16:18:25 +0800 |
---|---|---|
committer | Daniel Veillard <veillard@redhat.com> | 2011-12-14 16:18:25 +0800 |
commit | 77404b8b69bc122d12231807abf1a837d121b551 (patch) | |
tree | e9d76cb5960e4441c3765bcbf17242ce437e8ead /parser.c | |
parent | cb3549e30a63935fa840d61412abe828b0c6753e (diff) | |
download | libxml2-77404b8b69bc122d12231807abf1a837d121b551.tar.gz |
Make sure the parser returns when getting a Stop order
patch backported from chromiun bug fixes, assuming author is Chris
Diffstat (limited to 'parser.c')
-rw-r--r-- | parser.c | 14 |
1 files changed, 11 insertions, 3 deletions
@@ -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; |