summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYannis Guyon <yguyon@google.com>2023-04-24 09:58:43 +0200
committerYannis Guyon <yguyon@google.com>2023-04-25 08:14:22 +0200
commit916548c28cf4f8634979cbb7e5bb4931c7281d09 (patch)
treecb5373ee788d66079e202d58b39eaaf95fbe97dc
parent4070b271abc235ac7ac0d74e76a565ebbd9a28bb (diff)
downloadlibwebp-916548c28cf4f8634979cbb7e5bb4931c7281d09.tar.gz
Make kFuzzPxLimit sanitizer dependent
Change-Id: Ib70f3c05fc845494c45cb357e70e9602a7e876a3
-rw-r--r--tests/fuzzer/advanced_api_fuzzer.c2
-rw-r--r--tests/fuzzer/fuzz_utils.h13
2 files changed, 13 insertions, 2 deletions
diff --git a/tests/fuzzer/advanced_api_fuzzer.c b/tests/fuzzer/advanced_api_fuzzer.c
index e60840dd..1378d0bc 100644
--- a/tests/fuzzer/advanced_api_fuzzer.c
+++ b/tests/fuzzer/advanced_api_fuzzer.c
@@ -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.
diff --git a/tests/fuzzer/fuzz_utils.h b/tests/fuzzer/fuzz_utils.h
index 713a5f40..3a4c5584 100644
--- a/tests/fuzzer/fuzz_utils.h
+++ b/tests/fuzzer/fuzz_utils.h
@@ -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;