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

Fix roundtrip bug #41

Merged
merged 3 commits into from
Jan 23, 2020
Merged

Fix roundtrip bug #41

merged 3 commits into from
Jan 23, 2020

Conversation

aschampion
Copy link
Contributor

This should be looked at by someone who understands the algorithm. I looked at which paths of process_chunk_lazy these inputs went through versus which paths they went through with a byte chopped off the end of the buffer (when there was no bug), and noticed that the failing cases exited in this macro call. This led me to suspect it was a wrong return value; removing the +1 offset fixed it. I was just a monkey with a hammer here.

There are ~50 failing cases now from the AFL fuzz, so tomorrow when I have access to box running the fuzz I'll see if this fixes those.

Closes #39.

After this is merged I'll update #40 so that AFL and the regression tests can share the same seed files, then mark that PR as ready.

Discovered by AFL and includes regression tests for the found inputs.

Closes image-rs#39.
@oyvindln
Copy link
Collaborator

Ah, thanks for the work, I haven't gotten around to investigating this.

Will have to check if the write_literal! call below needs to be altered as well. I'll wait with merging until you've tested.

When running the regression test, print out filename so that regressions
are easy to localize to particular cases.
Since these largely branch differently, this increases coverage.
@aschampion
Copy link
Contributor Author

This fixed all but three of the crashes fuzzing found so far. Will open the remaining failures as a new issue for tracking.

@aschampion aschampion mentioned this pull request Jan 19, 2020
@oyvindln oyvindln merged commit 999771d into image-rs:dev Jan 23, 2020
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.

AFL crash
2 participants