Verified Commit f83930c8 authored by Henri Sivonen's avatar Henri Sivonen Committed by ma1
Browse files

Bug 2053153 - Only check for high surrogates when intending to avoid split...

Bug 2053153 - Only check for high surrogates when intending to avoid split pair.  a=diannaS DONTBUILD

Original Revision: https://phabricator.services.mozilla.com/D314632

Differential Revision: https://phabricator.services.mozilla.com/D316466
parent 67ac4951
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
diff --git a/expat/expat/lib/xmltok.c b/expat/expat/lib/xmltok.c
--- a/expat/expat/lib/xmltok.c
+++ b/expat/expat/lib/xmltok.c
@@ -707,7 +707,9 @@ unicode_byte_type(char hi, char lo) {
     fromLim = *fromP + (((fromLim - *fromP) >> 1) << 1); /* shrink to even */  \
     /* Avoid copying first half only of surrogate */                           \
     if (fromLim - *fromP > ((toLim - *toP) << 1)                               \
-        && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) {                             \
+/* BEGIN MOZILLA CHANGE (Only high surrogate mask) */                          \
+        && (GET_HI(fromLim - 2) & 0xFC) == 0xD8) {                             \
+/* END MOZILLA CHANGE */                                                       \
       fromLim -= 2;                                                            \
       res = XML_CONVERT_INPUT_INCOMPLETE;                                      \
     }                                                                          \
+3 −1
Original line number Diff line number Diff line
@@ -705,7 +705,9 @@ unicode_byte_type(char hi, char lo) {
    fromLim = *fromP + (((fromLim - *fromP) >> 1) << 1); /* shrink to even */  \
    /* Avoid copying first half only of surrogate */                           \
    if (fromLim - *fromP > ((toLim - *toP) << 1)                               \
        && (GET_HI(fromLim - 2) & 0xF8) == 0xD8) {                             \
/* BEGIN MOZILLA CHANGE (Only high surrogate mask) */                          \
        && (GET_HI(fromLim - 2) & 0xFC) == 0xD8) {                             \
/* END MOZILLA CHANGE */                                                       \
      fromLim -= 2;                                                            \
      res = XML_CONVERT_INPUT_INCOMPLETE;                                      \
    }                                                                          \
+1 −0
Original line number Diff line number Diff line
@@ -62,3 +62,4 @@ vendoring:
    - 10_version_limit.patch
    - 11_no_debug_report.patch
    - 12_unused.patch
    - 13_high_surrogate_mask.patch