Skip to content

Large constant GC array causes runtime panics in a few ways #13034

@alexcrichton

Description

@alexcrichton

This test:

(module
  (type $i32_array (array (mut i32)))

  (global $arr (ref $i32_array)
    (array.new $i32_array (i32.const 0) (i32.const 1073741817))
  )

  (func (export "get") (result i32)
    (array.get $i32_array (global.get $arr) (i32.const 0))
  )
)

takes a long time to run in debug mode but yields:

$ cargo run wast -W gc ./test.wast
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.11s
     Running `target/debug/wasmtime wast -W gc ./reports/test_bug5_gc_array_overflow.wast`

thread 'main' (654954) panicked at crates/environ/src/gc.rs:356:9:
attempt to add with overflow
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

and in release mode:

$ cargo run --release wast -W gc ./test.wast
    Finished `release` profile [optimized] target(s) in 0.15s
     Running `target/release/wasmtime wast -W gc ./test.wast`

thread 'main' (654828) panicked at crates/wasmtime/src/runtime/vm/gc/gc_runtime.rs:467:56:
range end index 24 out of range for slice of length 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Metadata

Metadata

Assignees

No one assigned

    Labels

    wasm-proposal:gcIssues with the implementation of the gc wasm proposal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions