summaryrefslogtreecommitdiffstats
path: root/third_party
diff options
context:
space:
mode:
authorcevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-13 19:35:03 +0000
committercevans@chromium.org <cevans@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-13 19:35:03 +0000
commit44a637b47793512bfb1d2589d43b8dc492a97629 (patch)
tree6a9415f1383b83990f627e1cadf8b97e399ec0b2 /third_party
parent8d26d05e1a0eedc921cc26350caff06ce6a2a094 (diff)
downloadchromium_src-44a637b47793512bfb1d2589d43b8dc492a97629.zip
chromium_src-44a637b47793512bfb1d2589d43b8dc492a97629.tar.gz
chromium_src-44a637b47793512bfb1d2589d43b8dc492a97629.tar.bz2
Desist libxml from continuing the parse after a SAX callback has stopped the
parse. Attempt 2 -- now with less compile fail on Mac / Clang. BUG=95465 TBR=cdn TEST=covered by existing tests under ASAN Review URL: http://codereview.chromium.org/7892003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100953 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party')
-rw-r--r--third_party/libxml/README.chromium3
-rw-r--r--third_party/libxml/src/parser.c14
2 files changed, 13 insertions, 4 deletions
diff --git a/third_party/libxml/README.chromium b/third_party/libxml/README.chromium
index 970b287..83e4a2c 100644
--- a/third_party/libxml/README.chromium
+++ b/third_party/libxml/README.chromium
@@ -16,8 +16,9 @@ Modifications:
- Import follow-on for above commit: http://git.gnome.org/browse/libxml2/commit/?id=ea90b894146030c214a7df6d8375310174f134b9
- Import additional XPath fix http://git.gnome.org/browse/libxml2/commit/?id=df83c17e5a2646bd923f75e5e507bc80d73c9722
- Import follow-on fix for above commit: http://git.gnome.org/browse/libxml2/commit/?id=fec31bcd452e77c10579467ca87a785b41115de6
-- And a follow-on fix to the previous two fixes, commit upstream is pending.
+- And a follow-on fix to the previous two fixes, committed upstream: http://git.gnome.org/browse/libxml2/commit/?id=f5048b3e71fc30ad096970b8df6e7af073bae4cb (slightly differently, but we can drop our local fix on the next roll).
- Add a fix for handling of unknown namespaces, commit upstream is pending.
+- Add fixes for ending the parse properly if a SAX callback calls xmlStopParser(), commit upstream is pending.
To import a new snapshot of libxml:
diff --git a/third_party/libxml/src/parser.c b/third_party/libxml/src/parser.c
index 3ba2a06..61c9f46 100644
--- a/third_party/libxml/src/parser.c
+++ b/third_party/libxml/src/parser.c
@@ -4827,7 +4827,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));
@@ -4907,7 +4908,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;
}
}
@@ -9466,6 +9468,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;
@@ -10845,6 +10849,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;
@@ -11031,7 +11037,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;