diff options
author | Bimba Shrestha <bshrestha.msae@gmail.com> | 2019-09-13 23:04:48 (GMT) |
---|---|---|
committer | Bimba Shrestha <bshrestha.msae@gmail.com> | 2019-09-13 23:04:48 (GMT) |
commit | 9cb73d69c4d92e255826dfee47e46a6815955ee4 (patch) | |
tree | 8d0a64a8555b52035e52350a45858dc2bd910165 /ossfuzz/compress_hc_fuzzer.c | |
parent | 208694297a308da8dae2b3bb104bdab486d1b683 (diff) | |
download | lz4-9cb73d69c4d92e255826dfee47e46a6815955ee4.zip lz4-9cb73d69c4d92e255826dfee47e46a6815955ee4.tar.gz lz4-9cb73d69c4d92e255826dfee47e46a6815955ee4.tar.bz2 |
Addressing naming nits and moving size modification up in all fuzzers
Diffstat (limited to 'ossfuzz/compress_hc_fuzzer.c')
-rw-r--r-- | ossfuzz/compress_hc_fuzzer.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/ossfuzz/compress_hc_fuzzer.c b/ossfuzz/compress_hc_fuzzer.c index 3e28f42..fac5e6f 100644 --- a/ossfuzz/compress_hc_fuzzer.c +++ b/ossfuzz/compress_hc_fuzzer.c @@ -17,19 +17,17 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { FUZZ_dataProducer_t *producer = FUZZ_dataProducer_create(data, size); - size_t const dstCapacitySeed = FUZZ_dataProducer_uint32_seed(producer, + size_t const dstCapacitySeed = FUZZ_dataProducer_uint32(producer, 0, LZ4_compressBound(size)); - size_t const levelSeed = FUZZ_dataProducer_uint32_seed(producer, + size_t const levelSeed = FUZZ_dataProducer_uint32(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); - /* Restrict to remaining data from producer */ size = FUZZ_dataProducer_remainingBytes(producer); + size_t const dstCapacity = FUZZ_getRange_from_uint32(dstCapacitySeed, 0, size); + int const level = FUZZ_getRange_from_uint32(levelSeed, LZ4HC_CLEVEL_MIN, LZ4HC_CLEVEL_MAX); + + char* const dst = (char*)malloc(dstCapacity); + char* const rt = (char*)malloc(size); FUZZ_ASSERT(dst); FUZZ_ASSERT(rt); |