summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNathan Moinvaziri <nathan@solidstatenetworks.com>2021-05-27 09:31:47 -0700
committerHans Kristian Rosbach <hk-github@circlestorm.org>2021-05-30 15:49:39 +0200
commitc53fba58cd1cb0831ebccbd75d40a27d31e1f948 (patch)
treed3ebca43217a95a695bf7a5ae428b8a025312386 /test
parente5fdfc77b8826d3c4ac818919d77685877090e29 (diff)
Use different fuzzer bits in example_dict_fuzzer for more input value combinations.
Diffstat (limited to 'test')
-rw-r--r--test/fuzz/example_dict_fuzzer.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/test/fuzz/example_dict_fuzzer.c b/test/fuzz/example_dict_fuzzer.c
index 027c9a8..da1bb06 100644
--- a/test/fuzz/example_dict_fuzzer.c
+++ b/test/fuzz/example_dict_fuzzer.c
@@ -42,13 +42,13 @@ void test_dict_deflate(unsigned char **compr, size_t *comprLen) {
int method = Z_DEFLATED; /* The deflate compression method (the only one
supported in this version) */
- int windowBits = 8 + data[0] % 8; /* The windowBits parameter is the base
+ int windowBits = 8 + data[(dataLen > 1) ? 1:0] % 8; /* The windowBits parameter is the base
two logarithm of the window size (the size of the history buffer). It
should be in the range 8..15 for this version of the library. */
- int memLevel = 1 + data[0] % 9; /* memLevel=1 uses minimum memory but is
+ int memLevel = 1 + data[(dataLen > 2) ? 2:0] % 9; /* memLevel=1 uses minimum memory but is
slow and reduces compression ratio; memLevel=9 uses maximum memory for
optimal speed. */
- int strategy = data[0] % 5; /* [0..4]
+ int strategy = data[(dataLen > 3) ? 3:0] % 5; /* [0..4]
#define Z_FILTERED 1
#define Z_HUFFMAN_ONLY 2
#define Z_RLE 3