wasm-bindgen
wasm-bindgen copied to clipboard
"memory access out of bounds" on allocating large structs.
Describe the Bug
memory access out of bounds on allocating large structs.
runtime error
Steps to Reproduce
#[wasm_bindgen]
pub struct FoobarPass {
buf:[i32; 1024*512],
}
#[wasm_bindgen]
pub fn foobar_pass()->FoobarPass { // it's okay
FoobarPass{
buf: [0; 1024*512],
}
}
#[wasm_bindgen]
pub struct FoobarFail {
buf:[i32; 1024*256],
n:i64,
}
#[wasm_bindgen]
pub fn foobar_fail()->FoobarFail { // it fails
FoobarFail{
buf: [0; 1024*256],
n:0,
}
}
Expected Behavior
no error
Actual Behavior
Uncaught RuntimeError RuntimeError: memory access out of bounds