Bug 1506298 - When tokenizing a string containing an escape sequence consisting of U+005C REVERSE SOLIDUS followed by a literal multi-unit code point, properly interpret the whole sequence as representing that multi-unit code point -- not as representing the first code unit of that sequence. #oops r=jorendorff
authorJeff Walden <jwalden@mit.edu>
Sat, 10 Nov 2018 20:18:09 -0800
changeset 503831 1ba4426e7a591d0d8712dc21f8875bcdbe9b3b76
parent 503771 52a798ad6583b97fb3faf68f1849e7098d9ce4ae
child 503832 0252a8bad879a65be1fa7e69f287090a8782eaac
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1506298
milestone65.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1506298 - When tokenizing a string containing an escape sequence consisting of U+005C REVERSE SOLIDUS followed by a literal multi-unit code point, properly interpret the whole sequence as representing that multi-unit code point -- not as representing the first code unit of that sequence. #oops r=jorendorff
js/src/frontend/TokenStream.cpp
--- a/js/src/frontend/TokenStream.cpp
+++ b/js/src/frontend/TokenStream.cpp
@@ -3183,17 +3183,17 @@ TokenStreamSpecific<Unit, AnyCharsAccess
                     return false;
                 }
 
                 // If we consumed U+2028 LINE SEPARATOR or U+2029 PARAGRAPH
                 // SEPARATOR, they'll be normalized to '\n'.  '\' followed by
                 // LineContinuation represents no code points, so don't append
                 // in this case.
                 if (codePoint != '\n') {
-                    if (!this->charBuffer.append(unit)) {
+                    if (!appendCodePointToCharBuffer(AssertedCast<char32_t>(codePoint))) {
                         return false;
                     }
                 }
 
                 continue;
             }
 
             // The block above eliminated all non-ASCII, so cast to the