Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: src/unicode-inl.h

Issue 1967023004: [wasm] Add UTF-8 validation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase on parallel compilation Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/unicode.cc ('k') | src/wasm/module-decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2007-2010 the V8 project authors. All rights reserved. 1 // Copyright 2007-2010 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef V8_UNICODE_INL_H_ 5 #ifndef V8_UNICODE_INL_H_
6 #define V8_UNICODE_INL_H_ 6 #define V8_UNICODE_INL_H_
7 7
8 #include "src/unicode.h" 8 #include "src/unicode.h"
9 #include "src/base/logging.h" 9 #include "src/base/logging.h"
10 #include "src/utils.h" 10 #include "src/utils.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 if (Utf16::IsTrailSurrogate(c) && 130 if (Utf16::IsTrailSurrogate(c) &&
131 Utf16::IsLeadSurrogate(previous)) { 131 Utf16::IsLeadSurrogate(previous)) {
132 return kSizeOfUnmatchedSurrogate - kBytesSavedByCombiningSurrogates; 132 return kSizeOfUnmatchedSurrogate - kBytesSavedByCombiningSurrogates;
133 } 133 }
134 return 3; 134 return 3;
135 } else { 135 } else {
136 return 4; 136 return 4;
137 } 137 }
138 } 138 }
139 139
140 bool Utf8::IsValidCharacter(uchar c) {
141 return c < 0xD800u || (c >= 0xE000u && c < 0xFDD0u) ||
142 (c > 0xFDEFu && c <= 0x10FFFFu && (c & 0xFFFEu) != 0xFFFEu &&
143 c != kBadChar);
144 }
145
140 } // namespace unibrow 146 } // namespace unibrow
141 147
142 #endif // V8_UNICODE_INL_H_ 148 #endif // V8_UNICODE_INL_H_
OLDNEW
« no previous file with comments | « src/unicode.cc ('k') | src/wasm/module-decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698