[wasm] Fix bug with empty input to Wasm.instantiateModuleFromAsm()
R=ahaas@chromium.org,bradnelson@chromium.org BUG=chromium:605488 LOG=Y Review-Url: https://codereview.chromium.org/1940243002 Cr-Commit-Position: refs/heads/master@{#35974}
This commit is contained in:
parent
18c380c396
commit
98c2312995
@ -134,6 +134,11 @@ v8::internal::wasm::WasmModuleIndex* TranslateAsmModule(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (info->scope()->declarations()->length() == 0) {
|
||||
thrower->Error("Asm.js validation failed: no declarations in scope");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
info->set_literal(
|
||||
info->scope()->declarations()->at(0)->AsFunctionDeclaration()->fun());
|
||||
|
||||
|
12
test/mjsunit/regress/regress-605488.js
Normal file
12
test/mjsunit/regress/regress-605488.js
Normal file
@ -0,0 +1,12 @@
|
||||
// Copyright 2016 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
// Flags: --expose-wasm
|
||||
|
||||
try {
|
||||
Wasm.instantiateModuleFromAsm("");
|
||||
assertTrue(false);
|
||||
} catch (e) {
|
||||
print("Caught: " + e);
|
||||
}
|
Loading…
Reference in New Issue
Block a user