Skip to content

Commit 34628e8

Browse files
authored
Merge pull request #130 from iamarshsingh/master
Fixed Fuzzer, added Seed Corpus and Dictionary
2 parents 486d165 + bf2a032 commit 34628e8

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lodepng_fuzzer.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,11 @@ unsigned testDecode(lodepng::State& state, const uint8_t* data, size_t size) {
5858

5959
extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
6060
if(size == 0) return 0;
61-
size_t random_color_type = data[0] % num_combinations;
62-
data++;
63-
size--;
61+
62+
// Setting last byte of input as random_color_type
63+
// Fuzzer will still be able to mutate the data accordingly as
64+
// last byte of png file can be changed and file will still remain valid.
65+
size_t random_color_type = data[size-1] % num_combinations;
6466

6567
lodepng::State state;
6668

0 commit comments

Comments
 (0)