1
0
Fork 0
firefox/parser/expat/12_version_limit.patch
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

28 lines
1.2 KiB
Diff

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;