Adds small valid .pic file to fuzzer seed corpus; varies req_comp when fuzz-testing #1455
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.
Hi stb maintainers!
The goal of this pull request is to modify the fuzzer so that it can catch bugs like #1452. If I've put this together correctly, the CIFuzz automation should fail after finding the PIC crash in #1452 fairly quickly, then succeed once a fix for #1452 has been merged in.
I think there's two reasons why fuzz-testing didn't find issue #1452:
stbi__convert_format
only occurs ifreq_comp
is not 0 or 4. Previously, the fuzzing function always setreq_comp
to 4.PICT
) 84 bytes later is hard for the fuzzer to guess.So, this pull request
req_comp
to test with, and passes the initial N-1 bytes tostbi_load_from_memory
as the image to read. (Using the last byte of the input as both the last byte of the image and the byte that determinesreq_comp
might be a better idea; I'm not 100% sure about the best approach here.)stb_image
tests, and includes it in the fuzzer seed corpus. (This file contains an all-0 comment field, and 1 8bpp uncompressed packet that writes 0s to the RGB fields of the pixel.)Testing locally, libFuzzer can now find the crash in #1452 in about a second.
Thanks!