Fail on errors when building fuzzers

Fails on errors when building fuzzers with `fuzz.py` (adds `Werror`).
Currently allows `declaration-after-statement`, `c++-compat` and
`deprecated` as they are abundant in code (some fixes to
`declaration-after-statement` are presented in this commit).
This commit is contained in:
Yonatan Komornik
2024-03-18 15:51:28 -07:00
parent 6a0052a409
commit 3487a60950
5 changed files with 25 additions and 18 deletions
+11 -10
View File
@@ -37,17 +37,18 @@ int LLVMFuzzerTestOneInput(const uint8_t *src, size_t size)
FUZZ_ASSERT(dctx);
}
size_t const bufSize = FUZZ_dataProducer_uint32Range(producer, 0, 10 * size);
void *rBuf = FUZZ_malloc(bufSize);
size_t const dSize = ZSTD_decompressDCtx(dctx, rBuf, bufSize, src, size);
if (!ZSTD_isError(dSize)) {
/* If decompression was successful, the content size from the frame header(s) should be valid. */
unsigned long long const expectedSize = ZSTD_findDecompressedSize(src, size);
FUZZ_ASSERT(expectedSize != ZSTD_CONTENTSIZE_ERROR);
FUZZ_ASSERT(expectedSize == ZSTD_CONTENTSIZE_UNKNOWN || expectedSize == dSize);
{
size_t const bufSize = FUZZ_dataProducer_uint32Range(producer, 0, 10 * size);
void *rBuf = FUZZ_malloc(bufSize);
size_t const dSize = ZSTD_decompressDCtx(dctx, rBuf, bufSize, src, size);
if (!ZSTD_isError(dSize)) {
/* If decompression was successful, the content size from the frame header(s) should be valid. */
unsigned long long const expectedSize = ZSTD_findDecompressedSize(src, size);
FUZZ_ASSERT(expectedSize != ZSTD_CONTENTSIZE_ERROR);
FUZZ_ASSERT(expectedSize == ZSTD_CONTENTSIZE_UNKNOWN || expectedSize == dSize);
}
free(rBuf);
}
free(rBuf);
FUZZ_dataProducer_free(producer);