diff --git a/expat/lib/xmltok.c b/expat/lib/xmltok.c --- a/expat/lib/xmltok.c +++ b/expat/lib/xmltok.c @@ -1148,6 +1148,10 @@ static const char KW_yes[] = {ASCII_y, A static const char KW_no[] = {ASCII_n, ASCII_o, '\0'}; +/* BEGIN MOZILLA CHANGE (Bug 62157 - Document content is rendered even though version value is not "1.0") */ +static const char KW_XML_1_0[] = {ASCII_1, ASCII_PERIOD, ASCII_0, '\0'}; +/* END MOZILLA CHANGE */ + static int doParseXmlDecl(const ENCODING *(*encodingFinder)(const ENCODING *, const char *, const char *), @@ -1175,6 +1179,13 @@ doParseXmlDecl(const ENCODING *(*encodin *versionPtr = val; if (versionEndPtr) *versionEndPtr = ptr; +/* BEGIN MOZILLA CHANGE (Bug 62157 - Document content is rendered even though version value is not "1.0") */ + /* Anything else but a version="1.0" is invalid for us, until we support later versions. */ + if (!XmlNameMatchesAscii(enc, val, ptr - enc->minBytesPerChar, KW_XML_1_0)) { + *badPtr = val; + return 0; + } +/* END MOZILLA CHANGE */ if (! parsePseudoAttribute(enc, ptr, end, &name, &nameEnd, &val, &ptr)) { *badPtr = ptr; return 0;