diff options
author | Yann Collet <Cyan4973@users.noreply.github.com> | 2020-09-17 06:24:41 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-17 06:24:41 (GMT) |
commit | 1328c38a1507e9d6984685451909a6976a49ece9 (patch) | |
tree | ded14465d5bfaeefc4e8fc934f45b8efa2a51415 | |
parent | 440c8461d71a79ee927ce93077b58ad22d894d28 (diff) | |
parent | da1272979f4b79a7066631335a68512350a071fb (diff) | |
download | lz4-1328c38a1507e9d6984685451909a6976a49ece9.zip lz4-1328c38a1507e9d6984685451909a6976a49ece9.tar.gz lz4-1328c38a1507e9d6984685451909a6976a49ece9.tar.bz2 |
Merge pull request #913 from lz4/usan_null
fix #847
-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; |