diff options
author | Yann Collet <cyan@fb.com> | 2020-10-02 02:07:56 (GMT) |
---|---|---|
committer | Yann Collet <cyan@fb.com> | 2020-10-02 04:10:08 (GMT) |
commit | 1e5ff76b36c5eaa35aea78f690be045d496a0f3a (patch) | |
tree | c9fedd0549b82edea303cfa6f4bc426f3b6080e9 /tests/frametest.c | |
parent | 0aed7314de48c90b8aeed8df16bad38b585f19fe (diff) | |
download | lz4-1e5ff76b36c5eaa35aea78f690be045d496a0f3a.zip lz4-1e5ff76b36c5eaa35aea78f690be045d496a0f3a.tar.gz lz4-1e5ff76b36c5eaa35aea78f690be045d496a0f3a.tar.bz2 |
add LZ4F_decompress() tests with (NULL,0) input and output
fix one (rare & complex) issue discovered by this test
Diffstat (limited to 'tests/frametest.c')
-rw-r--r-- | tests/frametest.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/frametest.c b/tests/frametest.c index 3a0f64f..4d91bdf 100644 --- a/tests/frametest.c +++ b/tests/frametest.c @@ -851,9 +851,11 @@ size_t test_lz4f_decompression_wBuffers( /* read data from byte-exact buffer to catch out-of-bound reads */ { void* const iBuffer = malloc(iSizeMax); + void* const tmpop = (FUZ_rand(randState) & (oSize == 0)) ? NULL : op; + const void* const tmpip = (FUZ_rand(randState) & (iSize == 0)) ? NULL : iBuffer; assert(iBuffer != NULL); memcpy(iBuffer, ip, iSizeMax); - moreToFlush = LZ4F_decompress(dCtx, op, &oSize, iBuffer, &iSize, &dOptions); + moreToFlush = LZ4F_decompress(dCtx, tmpop, &oSize, tmpip, &iSize, &dOptions); free(iBuffer); } DISPLAYLEVEL(7, "oSize=%u, readSize=%u \n", (unsigned)oSize, (unsigned)iSize); |