From 102ed8b6bd5a80b556349f62275c4edb60fd100b Mon Sep 17 00:00:00 2001 From: Frank Tang Date: Tue, 31 Oct 2023 13:42:18 -0700 Subject: [PATCH] ICU-22563 Limit the size for calendar fuzzer Limit to 1000 bytes of valid test data so the fuzzer will not timeout because of running many operations. ICU-22563 fix comment --- icu4c/source/test/fuzzer/calendar_fuzzer.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/icu4c/source/test/fuzzer/calendar_fuzzer.cpp b/icu4c/source/test/fuzzer/calendar_fuzzer.cpp index c6071fdd4110..f10eb40c7413 100644 --- a/icu4c/source/test/fuzzer/calendar_fuzzer.cpp +++ b/icu4c/source/test/fuzzer/calendar_fuzzer.cpp @@ -52,6 +52,9 @@ const char* GetRandomCalendarType(uint8_t rnd) { extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { uint16_t rnd; + // Set the limit for the test data to 1000 bytes to avoid timeout for a + // very long list of operations. + if (size > 1000) { size = 1000; } if (size < 2*sizeof(rnd) + 1) return 0; icu::StringPiece fuzzData(reinterpret_cast(data), size); // Byte 0 and 1 randomly select a TimeZone