Skip to content

Commit

Permalink
ICU-22563 Limit the size for calendar fuzzer
Browse files Browse the repository at this point in the history
Limit to 1000 bytes of valid test data so the fuzzer will
not timeout because of running many operations.
  • Loading branch information
FrankYFTang committed Oct 31, 2023
1 parent a7c7d8f commit c61eb82
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions icu4c/source/test/fuzzer/calendar_fuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 long
// operation.
if (size > 1000) { size = 1000; }
if (size < 2*sizeof(rnd) + 1) return 0;
icu::StringPiece fuzzData(reinterpret_cast<const char *>(data), size);
// Byte 0 and 1 randomly select a TimeZone
Expand Down

0 comments on commit c61eb82

Please sign in to comment.