diff options
-rw-r--r-- | tests/fuzzer.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/fuzzer.c b/tests/fuzzer.c index 4658d79..1d8b5f6 100644 --- a/tests/fuzzer.c +++ b/tests/fuzzer.c @@ -1055,6 +1055,17 @@ static void FUZ_unitTests(int compressionLevel) FUZ_CHECKTEST(r >= 0, "LZ4_decompress_safe() should fail"); } } + + /* 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), + "compressing empty should give byte 0" + " (maxCSize == %u) (cSize == %u)", + (unsigned)maxCSize, (unsigned)cSize); + } + /* in-place compression test */ DISPLAYLEVEL(3, "in-place compression using LZ4_compress_default() :"); { int const sampleSize = 65 KB; |