From fc6e282d98668dea248c847f9cf13a0a4b55443a Mon Sep 17 00:00:00 2001 From: Frank Tang Date: Mon, 18 Dec 2023 23:33:39 -0800 Subject: [PATCH] ICU-22549 Limit Normalizer2 Fuzzer for 5K of input To avoid timeout --- icu4c/source/test/fuzzer/normalizer2_fuzzer.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/icu4c/source/test/fuzzer/normalizer2_fuzzer.cpp b/icu4c/source/test/fuzzer/normalizer2_fuzzer.cpp index 959da8c47b0..4258a276626 100644 --- a/icu4c/source/test/fuzzer/normalizer2_fuzzer.cpp +++ b/icu4c/source/test/fuzzer/normalizer2_fuzzer.cpp @@ -1,7 +1,7 @@ // © 2023 and later: Unicode, Inc. and others. // License & terms of use: http://www.unicode.org/copyright.html -// Fuzzer for ICU Calendar. +// Fuzzer for ICU Normalizer2. #include @@ -10,6 +10,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { uint16_t rnd; UChar32 char1, char2; + // To avoid timeout, limit the input to 5000 bytes + if (size > 5000) { + size = 5000; + } if (size < sizeof(rnd) + sizeof(char1) + sizeof(char2)) return 0; icu::StringPiece fuzzData(reinterpret_cast(data), size);