Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(753)

Side by Side Diff: third_party/libxml/src/parser.c

Issue 7886003: Revert 100883 - Desist libxml from continuing the parse after a SAX callback has stopped the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/libxml/README.chromium ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * parser.c : an XML 1.0 parser, namespaces and validity support are mostly 2 * parser.c : an XML 1.0 parser, namespaces and validity support are mostly
3 * implemented on top of the SAX interfaces 3 * implemented on top of the SAX interfaces
4 * 4 *
5 * References: 5 * References:
6 * The XML specification: 6 * The XML specification:
7 * http://www.w3.org/TR/REC-xml 7 * http://www.w3.org/TR/REC-xml
8 * Original 1.0 version: 8 * Original 1.0 version:
9 * http://www.w3.org/TR/1998/REC-xml-19980210 9 * http://www.w3.org/TR/1998/REC-xml-19980210
10 * XML second edition working draft 10 * XML second edition working draft
(...skipping 4809 matching lines...) Expand 10 before | Expand all | Expand 10 after
4820 } 4820 }
4821 SKIP(2); 4821 SKIP(2);
4822 4822
4823 /* 4823 /*
4824 * SAX: PI detected. 4824 * SAX: PI detected.
4825 */ 4825 */
4826 if ((ctxt->sax) && (!ctxt->disableSAX) && 4826 if ((ctxt->sax) && (!ctxt->disableSAX) &&
4827 (ctxt->sax->processingInstruction != NULL)) 4827 (ctxt->sax->processingInstruction != NULL))
4828 ctxt->sax->processingInstruction(ctxt->userData, 4828 ctxt->sax->processingInstruction(ctxt->userData,
4829 target, NULL); 4829 target, NULL);
4830 » » if (ctxt->instate != XML_PARSER_EOF) 4830 » » ctxt->instate = state;
4831 » » ctxt->instate = state;
4832 return; 4831 return;
4833 } 4832 }
4834 buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); 4833 buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar));
4835 if (buf == NULL) { 4834 if (buf == NULL) {
4836 xmlErrMemory(ctxt, NULL); 4835 xmlErrMemory(ctxt, NULL);
4837 ctxt->instate = state; 4836 ctxt->instate = state;
4838 return; 4837 return;
4839 } 4838 }
4840 cur = CUR; 4839 cur = CUR;
4841 if (!IS_BLANK(cur)) { 4840 if (!IS_BLANK(cur)) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
4901 */ 4900 */
4902 if ((ctxt->sax) && (!ctxt->disableSAX) && 4901 if ((ctxt->sax) && (!ctxt->disableSAX) &&
4903 (ctxt->sax->processingInstruction != NULL)) 4902 (ctxt->sax->processingInstruction != NULL))
4904 ctxt->sax->processingInstruction(ctxt->userData, 4903 ctxt->sax->processingInstruction(ctxt->userData,
4905 target, buf); 4904 target, buf);
4906 } 4905 }
4907 xmlFree(buf); 4906 xmlFree(buf);
4908 } else { 4907 } else {
4909 xmlFatalErr(ctxt, XML_ERR_PI_NOT_STARTED, NULL); 4908 xmlFatalErr(ctxt, XML_ERR_PI_NOT_STARTED, NULL);
4910 } 4909 }
4911 » if (ctxt->instate != XML_PARSER_EOF) 4910 » ctxt->instate = state;
4912 » ctxt->instate = state;
4913 } 4911 }
4914 } 4912 }
4915 4913
4916 /** 4914 /**
4917 * xmlParseNotationDecl: 4915 * xmlParseNotationDecl:
4918 * @ctxt: an XML parser context 4916 * @ctxt: an XML parser context
4919 * 4917 *
4920 * parse a notation declaration 4918 * parse a notation declaration
4921 * 4919 *
4922 * [82] NotationDecl ::= '<!NOTATION' S Name S (ExternalID | PublicID) S? '>' 4920 * [82] NotationDecl ::= '<!NOTATION' S Name S (ExternalID | PublicID) S? '>'
(...skipping 4538 matching lines...) Expand 10 before | Expand all | Expand 10 after
9461 9459
9462 line = ctxt->input->line; 9460 line = ctxt->input->line;
9463 #ifdef LIBXML_SAX1_ENABLED 9461 #ifdef LIBXML_SAX1_ENABLED
9464 if (ctxt->sax2) 9462 if (ctxt->sax2)
9465 #endif /* LIBXML_SAX1_ENABLED */ 9463 #endif /* LIBXML_SAX1_ENABLED */
9466 name = xmlParseStartTag2(ctxt, &prefix, &URI, &tlen); 9464 name = xmlParseStartTag2(ctxt, &prefix, &URI, &tlen);
9467 #ifdef LIBXML_SAX1_ENABLED 9465 #ifdef LIBXML_SAX1_ENABLED
9468 else 9466 else
9469 name = xmlParseStartTag(ctxt); 9467 name = xmlParseStartTag(ctxt);
9470 #endif /* LIBXML_SAX1_ENABLED */ 9468 #endif /* LIBXML_SAX1_ENABLED */
9471 if (ctxt->instate == XML_PARSER_EOF)
9472 return;
9473 if (name == NULL) { 9469 if (name == NULL) {
9474 spacePop(ctxt); 9470 spacePop(ctxt);
9475 return; 9471 return;
9476 } 9472 }
9477 namePush(ctxt, name); 9473 namePush(ctxt, name);
9478 ret = ctxt->node; 9474 ret = ctxt->node;
9479 9475
9480 #ifdef LIBXML_VALID_ENABLED 9476 #ifdef LIBXML_VALID_ENABLED
9481 /* 9477 /*
9482 * [ VC: Root Element Type ] 9478 * [ VC: Root Element Type ]
(...skipping 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after
10842 else 10838 else
10843 spacePush(ctxt, *ctxt->space); 10839 spacePush(ctxt, *ctxt->space);
10844 #ifdef LIBXML_SAX1_ENABLED 10840 #ifdef LIBXML_SAX1_ENABLED
10845 if (ctxt->sax2) 10841 if (ctxt->sax2)
10846 #endif /* LIBXML_SAX1_ENABLED */ 10842 #endif /* LIBXML_SAX1_ENABLED */
10847 name = xmlParseStartTag2(ctxt, &prefix, &URI, &tlen); 10843 name = xmlParseStartTag2(ctxt, &prefix, &URI, &tlen);
10848 #ifdef LIBXML_SAX1_ENABLED 10844 #ifdef LIBXML_SAX1_ENABLED
10849 else 10845 else
10850 name = xmlParseStartTag(ctxt); 10846 name = xmlParseStartTag(ctxt);
10851 #endif /* LIBXML_SAX1_ENABLED */ 10847 #endif /* LIBXML_SAX1_ENABLED */
10852 if (ctxt->instate == XML_PARSER_EOF)
10853 return;
10854 if (name == NULL) { 10848 if (name == NULL) {
10855 spacePop(ctxt); 10849 spacePop(ctxt);
10856 ctxt->instate = XML_PARSER_EOF; 10850 ctxt->instate = XML_PARSER_EOF;
10857 if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) 10851 if ((ctxt->sax) && (ctxt->sax->endDocument != NULL))
10858 ctxt->sax->endDocument(ctxt->userData); 10852 ctxt->sax->endDocument(ctxt->userData);
10859 goto done; 10853 goto done;
10860 } 10854 }
10861 #ifdef LIBXML_VALID_ENABLED 10855 #ifdef LIBXML_VALID_ENABLED
10862 /* 10856 /*
10863 * [ VC: Root Element Type ] 10857 * [ VC: Root Element Type ]
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
11030 xmlParseEndTag2(ctxt, 11024 xmlParseEndTag2(ctxt,
11031 (void *) ctxt->pushTab[ctxt->nameNr * 3 - 3], 11025 (void *) ctxt->pushTab[ctxt->nameNr * 3 - 3],
11032 (void *) ctxt->pushTab[ctxt->nameNr * 3 - 2], 0, 11026 (void *) ctxt->pushTab[ctxt->nameNr * 3 - 2], 0,
11033 (int) (long) ctxt->pushTab[ctxt->nameNr * 3 - 1], 0); 11027 (int) (long) ctxt->pushTab[ctxt->nameNr * 3 - 1], 0);
11034 nameNsPop(ctxt); 11028 nameNsPop(ctxt);
11035 } 11029 }
11036 #ifdef LIBXML_SAX1_ENABLED 11030 #ifdef LIBXML_SAX1_ENABLED
11037 else 11031 else
11038 xmlParseEndTag1(ctxt, 0); 11032 xmlParseEndTag1(ctxt, 0);
11039 #endif /* LIBXML_SAX1_ENABLED */ 11033 #endif /* LIBXML_SAX1_ENABLED */
11040 » » if (ctxt->instate == XML_PARSER_EOF) { 11034 » » if (ctxt->nameNr == 0) {
11041 » » /* Nothing */
11042 » » } else if (ctxt->nameNr == 0) {
11043 ctxt->instate = XML_PARSER_EPILOG; 11035 ctxt->instate = XML_PARSER_EPILOG;
11044 } else { 11036 } else {
11045 ctxt->instate = XML_PARSER_CONTENT; 11037 ctxt->instate = XML_PARSER_CONTENT;
11046 } 11038 }
11047 break; 11039 break;
11048 case XML_PARSER_CDATA_SECTION: { 11040 case XML_PARSER_CDATA_SECTION: {
11049 /* 11041 /*
11050 * The Push mode need to have the SAX callback for 11042 * The Push mode need to have the SAX callback for
11051 * cdataBlock merge back contiguous callbacks. 11043 * cdataBlock merge back contiguous callbacks.
11052 */ 11044 */
(...skipping 3805 matching lines...) Expand 10 before | Expand all | Expand 10 after
14858 if (stream == NULL) { 14850 if (stream == NULL) {
14859 xmlFreeParserInputBuffer(input); 14851 xmlFreeParserInputBuffer(input);
14860 return (NULL); 14852 return (NULL);
14861 } 14853 }
14862 inputPush(ctxt, stream); 14854 inputPush(ctxt, stream);
14863 return (xmlDoRead(ctxt, URL, encoding, options, 1)); 14855 return (xmlDoRead(ctxt, URL, encoding, options, 1));
14864 } 14856 }
14865 14857
14866 #define bottom_parser 14858 #define bottom_parser
14867 #include "elfgcchack.h" 14859 #include "elfgcchack.h"
OLDNEW
« no previous file with comments | « third_party/libxml/README.chromium ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698