Make kFuzzPxLimit sanitizer dependent

Change-Id: Ib70f3c05fc845494c45cb357e70e9602a7e876a3
This commit is contained in:
Yannis Guyon 2023-04-24 09:58:43 +02:00
parent 4070b271ab
commit 916548c28c
2 changed files with 13 additions and 2 deletions

View File

@ -85,7 +85,7 @@ int LLVMFuzzerTestOneInput(const uint8_t* const data, size_t size) {
scaled_height != config.input.height) {
// Using the WebPRescalerImport internally can significantly slow
// down the execution. Avoid timeouts due to that.
fuzz_px_limit /= 13;
fuzz_px_limit /= 2;
}
// A big output canvas can lead to out-of-memory and timeout issues,
// but a big internal working buffer can too.

View File

@ -28,9 +28,20 @@
//------------------------------------------------------------------------------
// Arbitrary limits to prevent OOM, timeout, or slow execution.
//
// The decoded image size, and for animations additionally the canvas size.
// Enabling some sanitizers slow down runtime significantly.
// Use a very low threshold in this case to avoid timeouts.
#if defined(__SANITIZE_ADDRESS__) // GCC
static const size_t kFuzzPxLimit = 1024 * 1024 / 10;
#elif !defined(__has_feature) // Clang
static const size_t kFuzzPxLimit = 1024 * 1024;
#elif __has_feature(address_sanitizer) || __has_feature(memory_sanitizer)
static const size_t kFuzzPxLimit = 1024 * 1024 / 10;
#else
static const size_t kFuzzPxLimit = 1024 * 1024;
#endif
// Demuxed or decoded animation frames.
static const int kFuzzFrameLimit = 3;