Skip to content

Commit

Permalink
ICU-22716 Extend Collator fuzzing
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankYFTang committed Sep 11, 2024
1 parent 3a74fcf commit 1c3bf0b
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions icu4c/source/test/fuzzer/collator_rulebased_fuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "unicode/coll.h"
#include "unicode/localpointer.h"
#include "unicode/locid.h"
#include "unicode/sortkey.h"
#include "unicode/tblcoll.h"

IcuEnvironment* env = new IcuEnvironment();
Expand All @@ -27,5 +28,20 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
icu::LocalPointer<icu::RuleBasedCollator> col1(
new icu::RuleBasedCollator(fuzzstr, status));

if (U_SUCCESS(status)) {
col1->getVariableTop(status);
status = U_ZERO_ERROR;
icu::CollationKey key;
col1->getCollationKey(fuzzstr, key, status);
status = U_ZERO_ERROR;
icu::LocalPointer<icu::UnicodeSet> tailoredSet(col1->getTailoredSet(status));
status = U_ZERO_ERROR;
col1->getLocale(ULOC_ACTUAL_LOCALE, status);
status = U_ZERO_ERROR;
col1->getLocale(ULOC_VALID_LOCALE, status);
col1->getMaxVariable();
col1->getStrength();
col1->getSortKey(fuzzstr, nullptr, 0);
}
return 0;
}

0 comments on commit 1c3bf0b

Please sign in to comment.