Fix the moves fuzz target.#97
Merged
cfallin merged 2 commits intobytecodealliance:mainfrom Oct 21, 2022
Merged
Conversation
elliottt
approved these changes
Oct 21, 2022
Member
elliottt
left a comment
There was a problem hiding this comment.
Looks great! Thank you for the write-up!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two fixes uncovered by a warning noted in #96:
The iteration that was meant to be adding between 0 and 2 scratch registers was adding zero or one instead, because it was written as
for i in u.int_in_range(0..=2)rather thanfor i in 0..u.int_in_range(0..=2)?. This is somewhat subtle but theResultis iterable so it was choosing zero ifu's input ended (making it unable to provide an arbitrary int) or one otherwise. This still would give some interesting fuzz coverage but was clearly not the original code's intent.Separately, it seems this fuzz target hadn't been run comprehensively in a while (we just run the toplevel
ion_checkertarget on OSS-Fuzz, which checks the whole allocator; this target is meant to be a more focused way of testing the move resolver when hacking on it, and probably isn't worth the OSS-Fuzz time otherwise). It pretty quickly hit a panic in the fuzz target itself on a stack-to-stack move, because earlier it was written not to generate these; but now it does, and we handle them successfully in the move resolver, so there's no reason to panic about a bad testcase.