Index: src/wasm/module-decoder.cc |
diff --git a/src/wasm/module-decoder.cc b/src/wasm/module-decoder.cc |
index ad2124ed98a776beb53395ca8c71601c1e57bb10..846da49bdb822a66eff15c9322b8226135e41a2b 100644 |
--- a/src/wasm/module-decoder.cc |
+++ b/src/wasm/module-decoder.cc |
@@ -461,8 +461,10 @@ class ModuleDecoder : public Decoder { |
// Decodes a single global entry inside a module starting at {pc_}. |
void DecodeGlobalInModule(WasmGlobal* global) { |
global->name_offset = consume_string(&global->name_length, false); |
- DCHECK(unibrow::Utf8::Validate(start_ + global->name_offset, |
- global->name_length)); |
+ if (!unibrow::Utf8::Validate(start_ + global->name_offset, |
+ global->name_length)) { |
+ error("global name is not valid utf8"); |
+ } |
global->type = consume_local_type(); |
global->offset = 0; |
global->exported = consume_u8("exported") != 0; |