Index: src/wasm/wasm-function-name-table.cc |
diff --git a/src/wasm/wasm-function-name-table.cc b/src/wasm/wasm-function-name-table.cc |
index 9abcd9b0917364101225ea04b8095fec4c6b8f28..f08270410da6c6b1fa1c2a71535c92529c9de9d2 100644 |
--- a/src/wasm/wasm-function-name-table.cc |
+++ b/src/wasm/wasm-function-name-table.cc |
@@ -60,6 +60,9 @@ Handle<Object> GetWasmFunctionNameFromTable(Handle<ByteArray> func_names_array, |
: func_names_array->get_int(func_index + 2); |
ScopedVector<byte> buffer(next_offset - offset); |
func_names_array->copy_out(offset, buffer.start(), next_offset - offset); |
+ if (!unibrow::Utf8::Validate(buffer.start(), buffer.length())) { |
+ return undefined(); |
+ } |
MaybeHandle<Object> maybe_name = |
func_names_array->GetIsolate()->factory()->NewStringFromUtf8( |
Vector<const char>::cast(buffer)); |