summaryrefslogtreecommitdiffstats
path: root/ossfuzz/round_trip_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/round_trip_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/round_trip_frame_fuzzer.c')
-rw-r--r--ossfuzz/round_trip_frame_fuzzer.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/ossfuzz/round_trip_frame_fuzzer.c b/ossfuzz/round_trip_frame_fuzzer.c
index c34553d..aea13bb 100644
--- a/ossfuzz/round_trip_frame_fuzzer.c
+++ b/ossfuzz/round_trip_frame_fuzzer.c
@@ -18,17 +18,16 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t 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(
- LZ4_compressBound(FUZZ_dataProducer_remainingBytes(producer)), &prefs);
+
+ size = FUZZ_dataProducer_remainingBytes(producer);
+ size_t const dstCapacity = LZ4F_compressFrameBound(LZ4_compressBound(size), &prefs);
+
char* const dst = (char*)malloc(dstCapacity);
char* const rt = (char*)malloc(FUZZ_dataProducer_remainingBytes(producer));
FUZZ_ASSERT(dst);
FUZZ_ASSERT(rt);
- /* Restrict to remaining data from producer */
- size = FUZZ_dataProducer_remainingBytes(producer);
-
/* Compression must succeed and round trip correctly. */
size_t const dstSize =
LZ4F_compressFrame(dst, dstCapacity, data, size, &prefs);