summaryrefslogtreecommitdiffstats
path: root/ossfuzz/round_trip_frame_fuzzer.c
diff options
context:
space:
mode:
authorBimba Shrestha <bshrestha.msae@gmail.com>2019-09-13 21:07:52 (GMT)
committerBimba Shrestha <bshrestha.msae@gmail.com>2019-09-13 21:07:52 (GMT)
commit208694297a308da8dae2b3bb104bdab486d1b683 (patch)
tree95930ec739b3e8d45be17732f5ef7d82bb584b23 /ossfuzz/round_trip_frame_fuzzer.c
parent7d153a704d00a266c9601c947e07fd33e1cd6f4d (diff)
downloadlz4-208694297a308da8dae2b3bb104bdab486d1b683.zip
lz4-208694297a308da8dae2b3bb104bdab486d1b683.tar.gz
lz4-208694297a308da8dae2b3bb104bdab486d1b683.tar.bz2
Seperating the seed generation and use
Diffstat (limited to 'ossfuzz/round_trip_frame_fuzzer.c')
-rw-r--r--ossfuzz/round_trip_frame_fuzzer.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ossfuzz/round_trip_frame_fuzzer.c b/ossfuzz/round_trip_frame_fuzzer.c
index fe6fc77..c34553d 100644
--- a/ossfuzz/round_trip_frame_fuzzer.c
+++ b/ossfuzz/round_trip_frame_fuzzer.c
@@ -16,11 +16,12 @@
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
{
- FUZZ_dataProducer_t* producer = FUZZ_dataProducer_create(data, LZ4_compressBound(size));
+ FUZZ_dataProducer_t* producer = FUZZ_dataProducer_create(data, size);
LZ4F_preferences_t const prefs = FUZZ_dataProducer_preferences(producer);
- size_t const dstCapacity = LZ4F_compressFrameBound(size, &prefs);
+ size_t const dstCapacity = LZ4F_compressFrameBound(
+ LZ4_compressBound(FUZZ_dataProducer_remainingBytes(producer)), &prefs);
char* const dst = (char*)malloc(dstCapacity);
- char* const rt = (char*)malloc(size);
+ char* const rt = (char*)malloc(FUZZ_dataProducer_remainingBytes(producer));
FUZZ_ASSERT(dst);
FUZZ_ASSERT(rt);