summaryrefslogtreecommitdiffstats
path: root/tests/fuzzer.c
diff options
context:
space:
mode:
authorYann Collet <cyan@fb.com>2020-09-15 21:54:53 (GMT)
committerYann Collet <cyan@fb.com>2020-09-15 21:54:53 (GMT)
commitda1272979f4b79a7066631335a68512350a071fb (patch)
treeded14465d5bfaeefc4e8fc934f45b8efa2a51415 /tests/fuzzer.c
parent4f33a5935b36783abb930252e4da487625817ee2 (diff)
downloadlz4-da1272979f4b79a7066631335a68512350a071fb.zip
lz4-da1272979f4b79a7066631335a68512350a071fb.tar.gz
lz4-da1272979f4b79a7066631335a68512350a071fb.tar.bz2
fix #847
support NULL input without triggering undefined sanitizer
Diffstat (limited to 'tests/fuzzer.c')
-rw-r--r--tests/fuzzer.c7
1 files 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 */