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

[crash] unwrap panic while parsing wasm module with incorrect version #29

Closed
pventuzelo opened this issue Jun 12, 2020 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@pventuzelo
Copy link

Hey,

When providing this module to wain parser, I triggered a panic due to unwrapping on Result::Err variant.

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: TryFromSliceError(())', /home/scop/.cargo/registry/src/github.com-1ecc6299db9ec823/wain-syntax-binary-0.1.3/src/parser.rs:250:61
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Download: crash_wain_unwrap.zip

@rhysd rhysd added the bug Something isn't working label Jun 12, 2020
@rhysd
Copy link
Owner

rhysd commented Jun 12, 2020

I could reproduce this. Thank you for reporting.

@rhysd rhysd closed this as completed in 655e0c0 Jun 12, 2020
@rhysd
Copy link
Owner

rhysd commented Jun 12, 2020

I fixed it at 655e0c0. Now an error is caused properly:

> cargo run crash_wain_unwrap.wasm
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s
     Running `target/debug/wain crash_wain_unwrap.wasm`
Error on parsing: expected version [1 0 0 0] but got [1, 49, 57, 0] while parsing module. caused at byte offset 4

 ... 01 31 39 00 61 73 6d 01 31 39 35 01
     ^
     starts from here

I think I should setup fuzz test.

rhysd added a commit that referenced this issue Jun 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants