Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[lightbeam] panic due to assert! in function_body.rs #673

Closed
pventuzelo opened this issue Dec 5, 2019 · 2 comments
Closed

[lightbeam] panic due to assert! in function_body.rs #673

pventuzelo opened this issue Dec 5, 2019 · 2 comments
Labels
fuzz-bug Bugs found by a fuzzer lightbeam Issues related to the Lightbeam compiler

Comments

@pventuzelo
Copy link
Contributor

Issue description

wasmtime with lightbeam backend panic due to an assert!. This issue will make program calling lightbeam as 3rd party library to crash. Instead an error should be through to let the caller handle it properly.

Reproduction

wasmtime commit: 3558d41

Compilation with debug info:

$ RUSTFLAGS=-g cargo build --release --features lightbeam

Download & run testcase:
panic_assert_elem_br_table.zip

$ unzip panic_assert_elem_br_table.zip
$ ./target/release/wasmtime --lightbeam panic_assert_elem_br_table.wasm
thread 'main' panicked at 'Can't pass different params to different elements of `br_table` yet', crates/lightbeam/src/function_body.rs:495:29
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

Related piece of code

lightbeam panics because of a calling to assert! macro.

if block.calling_convention.is_some() {
let new_cc = block.calling_convention.clone();
assert!(
cc.is_none() || cc == new_cc,
"Can't pass different params to different elements of `br_table` \
yet"
);
cc = new_cc;

Fix proposal

After applying the pull request 672, wasmtime will return:

$ ./target/release/wasmtime --lightbeam panic_assert_elem_br_table.wasm
Error: failed to process main module `panic_assert_elem_br_table.wasm`

Caused by:
    0: WebAssembly failed to compile
    1: Compilation error: Failed to translate function: Microwasm error: Can't pass different params to different elements of `br_table` yet
@pventuzelo
Copy link
Contributor Author

@fitzgen can you add fuzz-bug label on this one? Thanks

@fitzgen fitzgen added the fuzz-bug Bugs found by a fuzzer label Dec 10, 2019
@pepyakin pepyakin added the lightbeam Issues related to the Lightbeam compiler label Jan 6, 2020
@pventuzelo
Copy link
Contributor Author

merged in master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fuzz-bug Bugs found by a fuzzer lightbeam Issues related to the Lightbeam compiler
Projects
None yet
Development

No branches or pull requests

3 participants