diff options
author | Bimba Shrestha <bshrestha.msae@gmail.com> | 2019-09-13 21:07:52 (GMT) |
---|---|---|
committer | Bimba Shrestha <bshrestha.msae@gmail.com> | 2019-09-13 21:07:52 (GMT) |
commit | 208694297a308da8dae2b3bb104bdab486d1b683 (patch) | |
tree | 95930ec739b3e8d45be17732f5ef7d82bb584b23 /ossfuzz/compress_hc_fuzzer.c | |
parent | 7d153a704d00a266c9601c947e07fd33e1cd6f4d (diff) | |
download | lz4-208694297a308da8dae2b3bb104bdab486d1b683.zip lz4-208694297a308da8dae2b3bb104bdab486d1b683.tar.gz lz4-208694297a308da8dae2b3bb104bdab486d1b683.tar.bz2 |
Seperating the seed generation and use
Diffstat (limited to 'ossfuzz/compress_hc_fuzzer.c')
-rw-r--r-- | ossfuzz/compress_hc_fuzzer.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/ossfuzz/compress_hc_fuzzer.c b/ossfuzz/compress_hc_fuzzer.c index 5f22104..3e28f42 100644 --- a/ossfuzz/compress_hc_fuzzer.c +++ b/ossfuzz/compress_hc_fuzzer.c @@ -17,12 +17,16 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { FUZZ_dataProducer_t *producer = FUZZ_dataProducer_create(data, size); - size_t const dstCapacity = FUZZ_dataProducer_uint32( - producer, 0, LZ4_compressBound(size)); + size_t const dstCapacitySeed = FUZZ_dataProducer_uint32_seed(producer, + 0, LZ4_compressBound(size)); + size_t const levelSeed = FUZZ_dataProducer_uint32_seed(producer, + LZ4HC_CLEVEL_MIN, LZ4HC_CLEVEL_MAX); + size_t const dstCapacity = FUZZ_dataProducer_uint32(dstCapacitySeed, + 0, FUZZ_dataProducer_remainingBytes(producer)); + int const level = FUZZ_dataProducer_uint32( + levelSeed, LZ4HC_CLEVEL_MIN, LZ4HC_CLEVEL_MAX); char* const dst = (char*)malloc(dstCapacity); char* const rt = (char*)malloc(size); - int const level = FUZZ_dataProducer_uint32( - producer, LZ4HC_CLEVEL_MIN, LZ4HC_CLEVEL_MAX); /* Restrict to remaining data from producer */ size = FUZZ_dataProducer_remainingBytes(producer); |