Index: src/wasm/module-decoder.cc |
diff --git a/src/wasm/module-decoder.cc b/src/wasm/module-decoder.cc |
index 7ffa7b1e78bedb1fab0ff7edd0352605646406c4..09b52a45c5b32da638a3adbe0bf0d75869e700e2 100644 |
--- a/src/wasm/module-decoder.cc |
+++ b/src/wasm/module-decoder.cc |
@@ -461,7 +461,8 @@ 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); |
- if (!unibrow::Utf8::Validate(start_ + global->name_offset, |
+ if (ok() && |
+ !unibrow::Utf8::Validate(start_ + global->name_offset, |
global->name_length)) { |
error("global name is not valid utf8"); |
} |