diff options
author | Yann Collet <cyan@fb.com> | 2020-11-08 02:24:02 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2020-11-08 02:24:02 (GMT) |
commit | b16b9fcdbc110876c9cd82ac1c3392abc0c2e1b3 (patch) | |
tree | ce398e80a5b42e371b2016b8b9cf3733667eaab6 /tests/fuzzer.c | |
parent | a2222a879fe77c33c96b5f9954a0328dc6df9850 (diff) | |
download | lz4-b16b9fcdbc110876c9cd82ac1c3392abc0c2e1b3.zip lz4-b16b9fcdbc110876c9cd82ac1c3392abc0c2e1b3.tar.gz lz4-b16b9fcdbc110876c9cd82ac1c3392abc0c2e1b3.tar.bz2 |
added similar tests for LZ4_saveDict()
fast (non-HC) variant
Diffstat (limited to 'tests/fuzzer.c')
-rw-r--r-- | tests/fuzzer.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/fuzzer.c b/tests/fuzzer.c index a411dd4..99361dd 100644 --- a/tests/fuzzer.c +++ b/tests/fuzzer.c @@ -1167,6 +1167,22 @@ static void FUZ_unitTests(int compressionLevel) FUZ_CHECKTEST(crcOrig!=crcNew, "LZ4_decompress_safe() decompression corruption"); } } + /* early saveDict */ + DISPLAYLEVEL(3, "saveDict (right after init) : "); + { LZ4_stream_t* const ctx = LZ4_initStream(&streamingState, sizeof(streamingState)); + assert(ctx != NULL); /* ensure init is successful */ + + /* Check access violation with asan */ + FUZ_CHECKTEST( LZ4_saveDict(&streamingState, NULL, 0) != 0, + "LZ4_saveDict() can't save anything into (NULL,0)"); + + /* Check access violation with asan */ + { char tmp_buffer[240] = { 0 }; + FUZ_CHECKTEST( LZ4_saveDict(&streamingState, tmp_buffer, sizeof(tmp_buffer)) != 0, + "LZ4_saveDict() can't save anything since compression hasn't started"); + } } + DISPLAYLEVEL(3, "OK \n"); + /* ring buffer test */ { XXH64_state_t xxhOrig; XXH64_state_t xxhNewSafe, xxhNewFast; @@ -1282,7 +1298,7 @@ static void FUZ_unitTests(int compressionLevel) FUZ_CHECKTEST( LZ4_saveDictHC(&sHC, tmp_buffer, sizeof(tmp_buffer)) != 0, "LZ4_saveDictHC() can't save anything since compression hasn't started"); } } - + DISPLAYLEVEL(3, "OK \n"); /* long sequence test */ DISPLAYLEVEL(3, "Long sequence HC_destSize test : "); |