diff options
author | Yann Collet <yann.collet.73@gmail.com> | 2020-09-15 20:45:06 (GMT) |
---|---|---|
committer | Yann Collet <yann.collet.73@gmail.com> | 2020-09-15 20:45:06 (GMT) |
commit | 4f33a5935b36783abb930252e4da487625817ee2 (patch) | |
tree | c004f2c579297392d2e7aa27264deb088e2d9fcb /tests | |
parent | 440c8461d71a79ee927ce93077b58ad22d894d28 (diff) | |
download | lz4-4f33a5935b36783abb930252e4da487625817ee2.zip lz4-4f33a5935b36783abb930252e4da487625817ee2.tar.gz lz4-4f33a5935b36783abb930252e4da487625817ee2.tar.bz2 |
added test triggering NULL arithmetic with usan
described in #847
Diffstat (limited to 'tests')
-rw-r--r-- | tests/fuzzer.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/fuzzer.c b/tests/fuzzer.c index 4658d79..5ca0d31 100644 --- a/tests/fuzzer.c +++ b/tests/fuzzer.c @@ -1055,6 +1055,14 @@ 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, "compressed empty is byte 0"); + } + /* in-place compression test */ DISPLAYLEVEL(3, "in-place compression using LZ4_compress_default() :"); { int const sampleSize = 65 KB; |