Skip to content

Commit

Permalink
ICU-22549 Fix fuzzer to call Locale with null-terminiate string
Browse files Browse the repository at this point in the history
  • Loading branch information
FrankYFTang committed Jan 5, 2024
1 parent cfba9a8 commit 3f054ad
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion icu4c/source/test/fuzzer/plurrule_fuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
status = U_ZERO_ERROR;
TestPluralRulesWithLocale(locale, number, dbl, type, status);

icu::Locale locale2 = icu::Locale(fuzzData.data());
std::string str(fuzzData.data(), fuzzData.size()); // ensure null-terminate
// by std::string c_str
icu::Locale locale2(str.c_str());

status = U_ZERO_ERROR;
TestPluralRulesWithLocale(locale2, number, dbl, type, status);
Expand Down

0 comments on commit 3f054ad

Please sign in to comment.