From da1272979f4b79a7066631335a68512350a071fb Mon Sep 17 00:00:00 2001 From: Yann Collet Date: Tue, 15 Sep 2020 14:54:53 -0700 Subject: fix #847 support NULL input without triggering undefined sanitizer --- tests/fuzzer.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/fuzzer.c b/tests/fuzzer.c index 5ca0d31..1d8b5f6 100644 --- a/tests/fuzzer.c +++ b/tests/fuzzer.c @@ -1059,8 +1059,11 @@ static void FUZ_unitTests(int compressionLevel) /* useful to trigger undefined sanitizer */ DISPLAYLEVEL(3, "LZ4_compress_default() with NULL input \n"); { int const maxCSize = LZ4_compressBound(0); - int const cSize = LZ4_compress_default(NULL, testCompressed, 0, maxCSize); - FUZ_CHECKTEST(cSize==1 && testCompressed[0]==0, "compressed empty is byte 0"); + int const cSize = LZ4_compress_default(NULL, testCompressed, 0, maxCSize); + FUZ_CHECKTEST(!(cSize==1 && testCompressed[0]==0), + "compressing empty should give byte 0" + " (maxCSize == %u) (cSize == %u)", + (unsigned)maxCSize, (unsigned)cSize); } /* in-place compression test */ -- cgit v0.12