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.

ICU-22563 fix comment
  • Loading branch information
FrankYFTang committed Nov 16, 2023
1 parent 511e5ef commit 102ed8b
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 a
// very long list of operations.
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 102ed8b

Please sign in to comment.