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/fuzzing] "index out of bounds" in wain validate #39

Closed
pventuzelo opened this issue Jul 7, 2020 · 2 comments
Closed

[crash/fuzzing] "index out of bounds" in wain validate #39

pventuzelo opened this issue Jul 7, 2020 · 2 comments
Labels
bug Something isn't working

Comments

@pventuzelo
Copy link

Hey,

My fuzzer just triggered this panic index out of bounds error.

Crash:

$ ./target/debug/wain index_oob_wain.wasm 
thread 'main' panicked at 'index out of bounds: the len is 4 but the index is 93', /home/scop/Documents/wain/wain-validate/src/insn.rs:391:28
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Download:
index_oob_wain.zip

Bug is happening here:

// func.idx was already validated
let fty = &ctx.outer.module.types[func.idx as usize];
// Pop extracts parameters in reverse order

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

rhysd commented Jul 8, 2020

Thank you for catching this. I'll look into.

@rhysd rhysd closed this as completed in 08527f5 Jul 8, 2020
@rhysd
Copy link
Owner

rhysd commented Jul 8, 2020

This issue was fixed at 08527f5. Now it raises validation error as follows:

Error on validation: type index 93 out of bounds 0 <= idx < 4. error while validating callee at call instruction.  caused at byte offset 562

 ... 34 36 37 34 34 30 37 33 37 30 39 35 35 31 36 31 35 01 2b 26 3c 30 81 90 9b
     ^
     starts from here

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