Skip to content

Commit

Permalink
ICU-22929 Improve fuzzer to find leak from udat_open
Browse files Browse the repository at this point in the history
Try to find out what cause ICU-23008. Use ICU-22929 as bug number
to improve fuzzer to find the problem.
According to ICU-23008 bug report, the leak of DecimalFormatSymbols
can be reach by udat_open when the style is UDAT_PATTERN
  • Loading branch information
FrankYFTang committed Jan 14, 2025
1 parent f8aa68b commit 457d26c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions icu4c/source/test/fuzzer/date_format_fuzzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,5 +90,11 @@ extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
icu::DateFormat::createDateTimeInstance(dateStyle, timeStyle, locale2));
df.reset(
icu::DateFormat::createDateTimeInstance(dateStyle2, timeStyle2, locale2));

UDateFormat* udf = udat_open(UDAT_PATTERN, UDAT_PATTERN, str.c_str(), nullptr, 0,
skeleton.getBuffer(), skeleton.length(), &status);
if (udf && U_SUCCESS(status)) {
udat_close(udf);
}
return EXIT_SUCCESS;
}

0 comments on commit 457d26c

Please sign in to comment.