Commit 6cf621ec authored by titzer's avatar titzer Committed by Commit bot

[wasm] Require global names to be validate UTF-8.

R=ahaas@chromium.org,bradnelson@chromium.org
BUG=chromium:628542

Review-Url: https://codereview.chromium.org/2207183002
Cr-Commit-Position: refs/heads/master@{#38317}
parent 80329cdd
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment