diff options
author | Arshdeep Singh <singh.arshdeep1999@gmail.com> | 2020-06-12 20:52:43 +0300 |
---|---|---|
committer | Arshdeep Singh <singh.arshdeep1999@gmail.com> | 2020-06-12 20:52:43 +0300 |
commit | 373c2f35b7805a4cd3a8820d00a76919dc470141 (patch) | |
tree | 220b200eb9a0f91fbbaba892e01608a51f5ddfd4 /lodepng_fuzzer.cpp | |
parent | 2c691de6557c4bcc99aa83234527e8db39d5917d (diff) |
Removed Seed and improved Fuzzer's color selection
1. Removed the seed corpus and uploaded it to Google Cloud bucket to
directly download from the oss-fuzz docker.
2. Made random color selection of fuzzer based on the last byte of the
input instead of the first byte as first byte of png file is always
fixed.
Diffstat (limited to 'lodepng_fuzzer.cpp')
-rw-r--r-- | lodepng_fuzzer.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lodepng_fuzzer.cpp b/lodepng_fuzzer.cpp index 0c7642e..00a0b7a 100644 --- a/lodepng_fuzzer.cpp +++ b/lodepng_fuzzer.cpp @@ -58,7 +58,11 @@ unsigned testDecode(lodepng::State& state, const uint8_t* data, size_t size) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if(size == 0) return 0; - size_t random_color_type = data[0] % num_combinations; + + // Setting last byte of input as random_color_type + // Fuzzer will still be able to mutate the data accordingly as + // last byte of png file can be changed and file will still remain valid. + size_t random_color_type = data[size-1] % num_combinations; lodepng::State state; |