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

Unified Diff: third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp

Issue 2583043002: parser: Invalid xml version on prolog shouldn't crash (Closed)
Patch Set: Created 4 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/parser/invalid-xml-ver.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
diff --git a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
index dc67a7045594120c3170fee3de37923296482e5c..fecf34a6a8124854ab27f3ba90ea651354d316bf 100644
--- a/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
+++ b/third_party/WebKit/Source/core/xml/parser/XMLDocumentParser.cpp
@@ -1271,8 +1271,15 @@ void XMLDocumentParser::startDocument(const String& version,
return;
}
- if (!version.isNull())
+ // Silently ignore XML version mismatch in the prologue.
+ // https://www.w3.org/TR/xml/#sec-prolog-dtd note says:
+ // "When an XML 1.0 processor encounters a document that specifies a 1.x
+ // version number other than '1.0', it will process it as a 1.0 document. This
+ // means that an XML 1.0 processor will accept 1.x documents provided they do
+ // not use any non-1.0 features."
+ if (!version.isNull() && supportsXMLVersion(version)) {
document()->setXMLVersion(version, ASSERT_NO_EXCEPTION);
+ }
if (standalone != StandaloneUnspecified)
document()->setXMLStandalone(standaloneInfo == StandaloneYes,
ASSERT_NO_EXCEPTION);
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/parser/invalid-xml-ver.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698