summaryrefslogtreecommitdiffstats
path: root/ossfuzz
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2022-07-10 22:32:42 (GMT)
committerYann Collet <cyan@fb.com>2022-07-10 22:32:42 (GMT)
commit34f25c3c1d34249c2ef029449360fd8c4110faf7 (patch)
treef72179adfc64170a6c116a9d636f6ca2ee6b7944 /ossfuzz
parent0b0e3330bcc62b8582ce6fee3a7465391f7b56c7 (diff)
downloadlz4-34f25c3c1d34249c2ef029449360fd8c4110faf7.zip
lz4-34f25c3c1d34249c2ef029449360fd8c4110faf7.tar.gz
lz4-34f25c3c1d34249c2ef029449360fd8c4110faf7.tar.bz2
fixed direct-leak in round_trip_fuzzer.c
reported by oss-fuzz
Diffstat (limited to 'ossfuzz')
-rw-r--r--ossfuzz/round_trip_fuzzer.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/ossfuzz/round_trip_fuzzer.c b/ossfuzz/round_trip_fuzzer.c
index 2c35d9a..6236201 100644
--- a/ossfuzz/round_trip_fuzzer.c
+++ b/ossfuzz/round_trip_fuzzer.c
@@ -23,13 +23,13 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
size_t const largeSize = 64 * 1024 - 1;
size_t const smallSize = 1024;
char* const dstPlusLargePrefix = (char*)malloc(dstCapacity + largeSize);
+ FUZZ_ASSERT(dstPlusLargePrefix);
char* const dstPlusSmallPrefix = dstPlusLargePrefix + largeSize - smallSize;
char* const largeDict = (char*)malloc(largeSize);
+ FUZZ_ASSERT(largeDict);
char* const smallDict = largeDict + largeSize - smallSize;
char* const dst = dstPlusLargePrefix + largeSize;
char* const rt = (char*)malloc(size);
-
- FUZZ_ASSERT(dst);
FUZZ_ASSERT(rt);
/* Compression must succeed and round trip correctly. */
@@ -109,6 +109,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
}
free(dstPlusLargePrefix);
+ free(largeDict);
free(rt);
FUZZ_dataProducer_free(producer);