mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-07 06:25:30 +00:00
ICU-22479 Limit the collator_compare_fuzzer
Test only first 4K bytes of data, which means compare two UnicodeString each with 1024 Unicodes at most. Avoid finding timeout issue due to large amount of data.
This commit is contained in:
parent
21f74b3698
commit
fab5faa3aa
1 changed files with 4 additions and 0 deletions
|
@ -33,6 +33,10 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
|
|||
icu::Collator::ECollationStrength strength = kStrength[rnd16 % kStrength.size()];
|
||||
const icu::Locale& locale = GetRandomLocale(rnd16 / kStrength.size());
|
||||
|
||||
// Limit the comparison size to 4096 to avoid unnecessary timeout
|
||||
if (size > 4096) {
|
||||
size = 4096;
|
||||
}
|
||||
std::unique_ptr<char16_t> compbuff1(new char16_t[size/4]);
|
||||
std::memcpy(compbuff1.get(), data, (size/4)*2);
|
||||
data = data + size/2;
|
||||
|
|
Loading…
Add table
Reference in a new issue