summaryrefslogtreecommitdiffstats
path: root/ossfuzz/decompress_frame_fuzzer.c
diff options
context:
space:
mode:
authorBimba Shrestha <bshrestha.msae@gmail.com>2019-09-13 23:04:48 (GMT)
committerBimba Shrestha <bshrestha.msae@gmail.com>2019-09-13 23:04:48 (GMT)
commit9cb73d69c4d92e255826dfee47e46a6815955ee4 (patch)
tree8d0a64a8555b52035e52350a45858dc2bd910165 /ossfuzz/decompress_frame_fuzzer.c
parent208694297a308da8dae2b3bb104bdab486d1b683 (diff)
downloadlz4-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/decompress_frame_fuzzer.c')
-rw-r--r--ossfuzz/decompress_frame_fuzzer.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/ossfuzz/decompress_frame_fuzzer.c b/ossfuzz/decompress_frame_fuzzer.c
index 1308100..cf88579 100644
--- a/ossfuzz/decompress_frame_fuzzer.c
+++ b/ossfuzz/decompress_frame_fuzzer.c
@@ -31,24 +31,24 @@ static void decompress(LZ4F_dctx* dctx, void* dst, size_t dstCapacity,
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, 4 * size);
size_t const largeDictSize = 64 * 1024;
- size_t const dictSizeSeed = FUZZ_dataProducer_uint32_seed(producer,
+ size_t const dictSizeSeed = FUZZ_dataProducer_uint32(producer,
0, largeDictSize);
- size_t const dstCapacity = FUZZ_dataProducer_uint32(
- dstCapacitySeed, 0, 4 * FUZZ_dataProducer_remainingBytes(producer));
- size_t const dictSize = FUZZ_dataProducer_uint32(
+
+ size = FUZZ_dataProducer_remainingBytes(producer);
+ size_t const dstCapacity = FUZZ_getRange_from_uint32(
+ dstCapacitySeed, 0, 4 * size);
+ size_t const dictSize = FUZZ_getRange_from_uint32(
dictSizeSeed, 0, largeDictSize);
+
char* const dst = (char*)malloc(dstCapacity);
char* const dict = (char*)malloc(dictSize);
LZ4F_decompressOptions_t opts;
LZ4F_dctx* dctx;
LZ4F_createDecompressionContext(&dctx, LZ4F_VERSION);
- /* Restrict to remaining data from producer */
- size = FUZZ_dataProducer_remainingBytes(producer);
-
FUZZ_ASSERT(dctx);
FUZZ_ASSERT(dst);
FUZZ_ASSERT(dict);