From 34f25c3c1d34249c2ef029449360fd8c4110faf7 Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Sun, 10 Jul 2022 15:32:42 -0700 Subject: fixed direct-leak in round_trip_fuzzer.c reported by oss-fuzz --- ossfuzz/round_trip_fuzzer.c | 5 +++-- 1 file 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); -- cgit v0.12