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

Unified Diff: src/wasm/utf8.h

Issue 1967023004: [wasm] Add UTF-8 validation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix signed/unsigned mismatch 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
Index: src/wasm/utf8.h
diff --git a/src/wasm/utf8.h b/src/wasm/utf8.h
new file mode 100644
index 0000000000000000000000000000000000000000..50eadbffb8e3d9506f4d10bf9f232a08ac144d5c
--- /dev/null
+++ b/src/wasm/utf8.h
@@ -0,0 +1,26 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
titzer 2016/05/12 08:29:14 I think we should put this in src/base, since it's
Clemens Hammacher 2016/05/12 11:21:41 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef V8_WASM_UNICODE_H_
+#define V8_WASM_UNICODE_H_
+
+#include <stdint.h>
+
+// UTF8 validation is currently only needed for WASM, so we add this utility
+// here.
+
+namespace v8 {
+namespace internal {
+namespace wasm {
+
+// Check if byte buffer contains a valid UTF8-encoded string.
+// Returns true if multi-byte decoding succeeded and all decoded characters are
+// valid character codepoints. Returns false otherwise.
+bool IsValidUtf8(const uint8_t *buf, int32_t len);
+
+} // namespace wasm
+} // namespace internal
+} // namespace v8
+
+#endif // V8_WASM_UNICODE_H_
« no previous file with comments | « src/wasm/module-decoder.cc ('k') | src/wasm/utf8.cc » ('j') | src/wasm/wasm-module.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698