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

Make sure parse_all stops on Errors #472

Merged
merged 1 commit into from
Feb 7, 2022

Conversation

Swatinem
Copy link
Contributor

@Swatinem Swatinem commented Feb 7, 2022

All uses of Parser::parse_all in the code immediately propagate errors
and thus stop iteration. However the Iterator interface does not mandate
this, and not handling the inner Result at all can way too easily lead
to infinite loops.

I found this while fuzzing symbolic that internally uses wasmparser: getsentry/symbolic#500

I see this crate does have some fuzz tests as well, but it would seem that this condition is never checked for? I can add something to verify this to the fuzz target here as well.

All uses of `Parser::parse_all` in the code immediately propagate errors
and thus stop iteration. However the Iterator interface does not mandate
this, and not handling the inner `Result` at all can way too easily lead
to infinite loops.
@alexcrichton
Copy link
Member

Seems reasonable to me, thanks!

And yeah if you'd like to add a fuzz target or update our fuzzers that'd be great!

@alexcrichton alexcrichton merged commit 4fce4f1 into bytecodealliance:main Feb 7, 2022
@Swatinem Swatinem deleted the fix/parseall-iter branch February 14, 2022 10:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants