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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/unicode.cc ('k') | src/wasm/module-decoder.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/unicode-inl.h
diff --git a/src/unicode-inl.h b/src/unicode-inl.h
index b22e4825280dc78836dcb4e032fec65c614dbcd7..ebebfaa1bd9c158a098a602311a9406083505e02 100644
--- a/src/unicode-inl.h
+++ b/src/unicode-inl.h
@@ -137,6 +137,12 @@ unsigned Utf8::Length(uchar c, int previous) {
}
}
+bool Utf8::IsValidCharacter(uchar c) {
+ return c < 0xD800u || (c >= 0xE000u && c < 0xFDD0u) ||
+ (c > 0xFDEFu && c <= 0x10FFFFu && (c & 0xFFFEu) != 0xFFFEu &&
+ c != kBadChar);
+}
+
} // namespace unibrow
#endif // V8_UNICODE_INL_H_
« 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