Skip to content

Commit

Permalink
[Wasm-GC] Add test for bug 258499
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=258499

Reviewed by Justin Michaud.

Add test for already fixed bug

* JSTests/wasm/gc/bug258499.js: Added.
(module):

Canonical link: https://commits.webkit.org/273812@main
  • Loading branch information
takikawa committed Jan 31, 2024
1 parent c90b5e7 commit bc55ef6
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions JSTests/wasm/gc/bug258499.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
//@ runWebAssemblySuite("--useWebAssemblyTypedFunctionReferences=true", "--useWebAssemblyGC=true")

import * as assert from "../assert.js";

function module(bytes, valid = true) {
let buffer = new ArrayBuffer(bytes.length);
let view = new Uint8Array(buffer);
for (let i = 0; i < bytes.length; ++i) {
view[i] = bytes.charCodeAt(i);
}
return new WebAssembly.Module(buffer);
}

// Could not disassemble due to validation errors
assert.throws(
() => new WebAssembly.Instance(module("\x00\x61\x73\x6d\x01\x00\x00\x00\x01\x96\x80\x80\x80\x00\x04\x50\x00\x5f\x00\x50\x00\x5e\x7f\x01\x50\x00\x60\x03\x7f\x7f\x7f\x01\x7f\x60\x00\x00\x03\x82\x80\x80\x80\x00\x01\x02\x04\x85\x80\x80\x80\x00\x01\x70\x01\x01\x01\x05\x84\x80\x80\x80\x00\x01\x01\x10\x20\x0d\x83\x80\x80\x80\x00\x01\x00\x03\x07\x88\x80\x80\x80\x00\x01\x04\x6d\x61\x69\x6e\x00\x00\x09\x8b\x80\x80\x80\x00\x01\x06\x00\x41\x00\x0b\x70\x01\xd2\x00\x0b\x0a\xa9\x80\x80\x80\x00\x01\x27\x00\x41\x9b\x9c\xe2\xa0\x7d\x41\xdf\xd5\xa7\x6f\x41\xaf\x7f\x47\x6d\x41\xa6\x8d\xe4\xb6\x7a\x41\xcd\x00\x47\x41\x14\x6f\xfb\x09\x01\x41\x33\xfb\x0b\x01\x0b")),
WebAssembly.CompileError,
"WebAssembly.Module doesn't validate: array.new_data in module with no data segments, in function at index 0"
);

0 comments on commit bc55ef6

Please sign in to comment.