ICU-22548 Reduce the loop limit to fail faster

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.
This commit is contained in:
Frank Tang 2023-10-13 13:54:18 -07:00 committed by Frank Yung-Fong Tang
parent bd9e5ed620
commit cb7b1b6506
2 changed files with 3 additions and 2 deletions

View file

@ -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,

View file

@ -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);