Skip to content

Commit

Permalink
Merge pull request #130 from iamarshsingh/master
Browse files Browse the repository at this point in the history
Fixed Fuzzer, added Seed Corpus and Dictionary
  • Loading branch information
lvandeve committed Jun 15, 2020
2 parents 486d165 + bf2a032 commit 34628e8
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lodepng_fuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +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;
data++;
size--;

// 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;

Expand Down

0 comments on commit 34628e8

Please sign in to comment.