Skip to content

Commit

Permalink
ICU-22548 Reduce the loop limit to fail faster
Browse files Browse the repository at this point in the history
Reduce the error return from about 100s to 30s to avoid
fuzzer 60s timeout error.
Also add a include file to fix uint8_t build breakage.
  • Loading branch information
FrankYFTang committed Oct 13, 2023
1 parent bd9e5ed commit cb7b1b6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions icu4c/source/i18n/collationbuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1119,9 +1119,9 @@ CollationBuilder::addWithClosure(const UnicodeString &nfdPrefix, const UnicodeSt
// Please let us know if you have a reasonable use case that needed
// for a practical Collation rule that needs to increase this limit.
// This value is needed for compiling a rule with eight Hangul syllables such as
// "&a=b쫊쫊쫊쫊쫊쫊쫊쫊" without error, which should be more than realistic
// "&a=b쫊쫊쫊쫊쫊쫊쫊" without error, which should be more than realistic
// usage.
static constexpr int32_t kClosureLoopLimit = 6560;
static constexpr int32_t kClosureLoopLimit = 3000;

uint32_t
CollationBuilder::addOnlyClosure(const UnicodeString &nfdPrefix, const UnicodeString &nfdString,
Expand Down
1 change: 1 addition & 0 deletions icu4c/source/test/fuzzer/locale_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#define I18N_ICU_FUZZ_LOCALE_UTIL_H_

#include <string>
#include "unicode/utypes.h"

// Takes uint8_t data from fuzzer, and makes a zero terminated string.
std::string MakeZeroTerminatedInput(const uint8_t* data, int32_t size);
Expand Down

0 comments on commit cb7b1b6

Please sign in to comment.