PR-URL: https://github.com/nodejs/node/pull/51362 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
31 lines
910 B
JavaScript
31 lines
910 B
JavaScript
// Copyright 2023 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: --no-wasm-lazy-compilation
|
|
|
|
d8.file.execute('test/mjsunit/wasm/wasm-module-builder.js');
|
|
|
|
{
|
|
const builder = new WasmModuleBuilder();
|
|
|
|
builder.addFunction("invalid_negative_heap", kSig_i_i)
|
|
.addBody([kExprRefNull, -0x30 & kLeb128Mask]);
|
|
|
|
assertThrows(() => builder.instantiate(), WebAssembly.CompileError,
|
|
/Unknown heap type/);
|
|
}
|
|
|
|
{
|
|
const builder = new WasmModuleBuilder();
|
|
|
|
// Keep in sync with wasm-limits.h.
|
|
let kWasmMaxTypes = 1000000;
|
|
|
|
builder.addFunction("invalid_positive_heap", kSig_i_i)
|
|
.addBody([kExprRefNull, ...wasmSignedLeb(kWasmMaxTypes)]);
|
|
|
|
assertThrows(() => builder.instantiate(), WebAssembly.CompileError,
|
|
/Type index .* is greater than the maximum number/);
|
|
}
|