summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <yann.collet.73@gmail.com>2020-09-15 20:45:06 (GMT)
committerYann Collet <yann.collet.73@gmail.com>2020-09-15 20:45:06 (GMT)
commit4f33a5935b36783abb930252e4da487625817ee2 (patch)
treec004f2c579297392d2e7aa27264deb088e2d9fcb
parent440c8461d71a79ee927ce93077b58ad22d894d28 (diff)
downloadlz4-4f33a5935b36783abb930252e4da487625817ee2.zip
lz4-4f33a5935b36783abb930252e4da487625817ee2.tar.gz
lz4-4f33a5935b36783abb930252e4da487625817ee2.tar.bz2
added test triggering NULL arithmetic with usan
described in #847
-rw-r--r--tests/fuzzer.c8
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;