[fuzz] Allow zero sized buffers for streaming fuzzers (#1945)
* Allow zero sized buffers in `stream_decompress`. Ensure that we never have two zero sized buffers in a row so we guarantee forwards progress. * Make case 4 in `stream_round_trip` do a zero sized buffers call followed by a full call to guarantee forwards progress. * Fix `limitCopy()` in legacy decoders. * Fix memcpy in `zstdmt_compress.c`. Catches the bug fixed in PR #1939
This commit is contained in:
@@ -96,6 +96,13 @@ static size_t compress(uint8_t *dst, size_t capacity,
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 4: {
|
||||
ZSTD_inBuffer nullIn = { NULL, 0, 0 };
|
||||
ZSTD_outBuffer nullOut = { NULL, 0, 0 };
|
||||
size_t const ret = ZSTD_compressStream2(cctx, &nullOut, &nullIn, ZSTD_e_continue);
|
||||
FUZZ_ZASSERT(ret);
|
||||
}
|
||||
/* fall-through */
|
||||
default: {
|
||||
size_t const ret =
|
||||
ZSTD_compressStream2(cctx, &out, &in, ZSTD_e_continue);
|
||||
|
||||
Reference in New Issue
Block a user