Skip to content

Incompatibility with WASI Preview 2 #753

@k0pernicus

Description

@k0pernicus

🐛 Bug Description

I tried to use twiggy on a WASM binary using WASI Preview 2, but go the following parsing error:

error: WASM error: Bad version number (at offset 4)
  caused by: Bad version number (at offset 4)

The WASM binary, compiled with the Rust wasm32-wasip1 target, is correctly parsed by twiggy.
So, I do think the problem is the parser is incompatible with the Rust wasm32-wasip2 target.

twiggy version: twiggy-opt 0.7.0

🌍 Test Case

As Github does not allow to upload a WASM binary, please to follow the case here:

cargo new --bin test_wasm_twiggy # Create a random project
cd test_wasm_twiggy && cargo build --release --target=wasm32-wasip2 # Compile the basic Rust project
twiggy top target/wasm32-wasip2/release/test_wasm_twiggy.wasm # Try to test the WASM binary

👟 Steps to Reproduce

Run twiggy top target/wasm32-wasip2/release/test_wasm_twiggy.wasm.

😲 Actual Behavior

error: WASM error: Bad version number (at offset 4)
  caused by: Bad version number (at offset 4)

🤔 Expected Behavior

Twiggy should parse the WASM binary correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions