c88246
diff -up firefox-91.7.0/parser/expat/lib/xmltok.c.expat-CVE-2022-25235 firefox-91.7.0/parser/expat/lib/xmltok.c
c88246
--- firefox-91.7.0/parser/expat/lib/xmltok.c.expat-CVE-2022-25235	2022-03-02 17:57:38.364361168 +0100
c88246
+++ firefox-91.7.0/parser/expat/lib/xmltok.c	2022-03-02 17:58:22.235512399 +0100
c88246
@@ -65,13 +65,6 @@
c88246
                       + ((((byte)[2]) >> 5) & 1)] \
c88246
          & (1u << (((byte)[2]) & 0x1F)))
c88246
 
c88246
-#define UTF8_GET_NAMING(pages, p, n) \
c88246
-  ((n) == 2 \
c88246
-  ? UTF8_GET_NAMING2(pages, (const unsigned char *)(p)) \
c88246
-  : ((n) == 3 \
c88246
-     ? UTF8_GET_NAMING3(pages, (const unsigned char *)(p)) \
c88246
-     : 0))
c88246
-
c88246
 /* Detection of invalid UTF-8 sequences is based on Table 3.1B
c88246
    of Unicode 3.2: http://www.unicode.org/unicode/reports/tr28/
c88246
    with the additional restriction of not allowing the Unicode
c88246
diff -up firefox-91.7.0/parser/expat/lib/xmltok_impl.c.expat-CVE-2022-25235 firefox-91.7.0/parser/expat/lib/xmltok_impl.c
c88246
--- firefox-91.7.0/parser/expat/lib/xmltok_impl.c.expat-CVE-2022-25235	2022-03-02 17:57:38.365361172 +0100
c88246
+++ firefox-91.7.0/parser/expat/lib/xmltok_impl.c	2022-03-02 18:04:51.240853247 +0100
c88246
@@ -34,7 +34,7 @@
c88246
    case BT_LEAD ## n: \
c88246
      if (end - ptr < n) \
c88246
        return XML_TOK_PARTIAL_CHAR; \
c88246
-     if (!IS_NAME_CHAR(enc, ptr, n)) { \
c88246
+     if (IS_INVALID_CHAR(enc, ptr, n) || ! IS_NAME_CHAR(enc, ptr, n)) { \
c88246
        *nextTokPtr = ptr; \
c88246
        return XML_TOK_INVALID; \
c88246
      } \
c88246
@@ -62,7 +62,7 @@
c88246
    case BT_LEAD ## n: \
c88246
      if (end - ptr < n) \
c88246
        return XML_TOK_PARTIAL_CHAR; \
c88246
-     if (!IS_NMSTRT_CHAR(enc, ptr, n)) { \
c88246
+     if (IS_INVALID_CHAR(enc, ptr, n) || ! IS_NMSTRT_CHAR(enc, ptr, n)) { \
c88246
        *nextTokPtr = ptr; \
c88246
        return XML_TOK_INVALID; \
c88246
      } \
c88246
@@ -1090,6 +1090,10 @@ PREFIX(prologTok)(const ENCODING *enc, c
c88246
   case BT_LEAD ## n: \
c88246
     if (end - ptr < n) \
c88246
       return XML_TOK_PARTIAL_CHAR; \
c88246
+    if (IS_INVALID_CHAR(enc, ptr, n)) {                                        \
c88246
+      *nextTokPtr = ptr;                                                       \
c88246
+      return XML_TOK_INVALID;                                                  \
c88246
+    }                                                                          \
c88246
     if (IS_NMSTRT_CHAR(enc, ptr, n)) { \
c88246
       ptr += n; \
c88246
       tok = XML_TOK_NAME; \