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 some issues detected by fuzzing #24

Merged
merged 1 commit into from
Dec 25, 2023
Merged

Conversation

fintelia
Copy link
Contributor

@fintelia fintelia commented Dec 20, 2023

I still want to do more cleanup before merging, but this has fixes for three issues detected by fuzzing. Two were places where the decoder didn't properly reject invalid bitstreams. The final issue is that the color indexing transform was implemented wrong in cases where 16 or fewer colors were in use, causing us to decode incorrectly and possibly index out of bounds. I believe that could result in valid images being decoded garbled.

With this patch applied, fuzzing no longer immediately crashes for me when running with the seed corpus from https://lcamtuf.coredump.cx/afl/demo. However, I haven't had a chance to fuzz for an extended length of time. And cargo fuzz does occasionally print messages about specific inputs taking nearly a minute to run

Edit: I'll handle the color indexing transform issue is a separate PR, hopefully with a regression test. For now, this PR just includes three smaller bitstream issues.

@fintelia fintelia force-pushed the fuzz-fixes branch 2 times, most recently from 3471c62 to eafb7a6 Compare December 25, 2023 22:12
@fintelia fintelia marked this pull request as ready for review December 25, 2023 22:16
@fintelia fintelia merged commit 49e6e0a into image-rs:main Dec 25, 2023
9 checks passed
@fintelia fintelia deleted the fuzz-fixes branch December 25, 2023 22:17
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.

1 participant