Open
Description
Describe the bug
The table.grow instruction grows table by a given delta and returns the previous size, or −1 if enough space cannot be allocated. It also takes an initialization value for the newly allocated entries.
cargo run --release
memory allocation of 34359738360 bytes failed
[1] 19812 IOT instruction (core dumped) cargo run --release
rustc -vV
rustc 1.83.0 (90b35a623 2024-11-26)
binary: rustc
commit-hash: 90b35a6239c3d8bdabc530a6a0816f7ff89a0aaf
commit-date: 2024-11-26
host: x86_64-unknown-linux-gnu
release: 1.83.0
LLVM version: 19.1.1
Steps to reproduce
[package]
name = "wasmer-playground"
version = "0.1.0"
edition = "2021"
[dependencies]
wasmer = { version = "5", default-features = false, features = ["singlepass", "wat"] }
use std::error::Error;
use wasmer::{imports, Instance, Module, Store};
fn main() -> Result<(), Box<dyn Error>> {
let module_wat = r#"
(module
(table $t0 0 externref)
(table $t1 10 externref)
(func $init (export "init")
(if (i32.ne (table.size $t1) (i32.const 10))
(then (unreachable))
)
(table.grow $t0 (ref.null extern) (i32.const 0xff_ff_ff_ff))
(drop)
)
)
"#;
let mut store = Store::default();
let module = Module::new(&store, &module_wat)?;
let import_object = imports! {};
let instance = Instance::new(&mut store, &module, &import_object)?;
let init = instance.exports.get_function("init")?;
let result = init.call(&mut store, &[])?;
dbg!(result);
Ok(())
}