v8/test/mjsunit/regress/wasm/regress-1239116.js
Clemens Backes 72abfdc763 [wasm] Add regression tests for 1239116
The fix is released now, so we can add the tests to the public repo.

R=ahaas@chromium.org

Bug: chromium:1239116
Change-Id: Ie1489f6bcd934f84222b4631921475c389f778dd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3172752
Reviewed-by: Andreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76957}
2021-09-21 09:37:17 +00:00

20 lines
674 B
JavaScript

// Copyright 2021 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.
load('test/mjsunit/wasm/wasm-module-builder.js');
const builder = new WasmModuleBuilder();
builder.addMemory(1, 1, true);
builder.addFunction('main', kSig_i_v)
.addBody([
kExprI32Const, 0, // i32.const
kExprI32LoadMem8S, 0, 0, // i32.load8_s
kExprI32LoadMem, 0, 0, // i32.load
])
.exportFunc();
const instance = builder.instantiate();
let mem = new Uint8Array(instance.exports.memory.buffer);
mem[0] = -1;
assertTraps(kTrapMemOutOfBounds, instance.exports.main);