Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICU-22549 Add DateFormatSymbols fuzzer #2748

Merged
merged 1 commit into from
Dec 16, 2023

Conversation

FrankYFTang
Copy link
Contributor

Checklist
  • Required: Issue filed: https://unicode-org.atlassian.net/browse/ICU-22549
  • Required: The PR title must be prefixed with a JIRA Issue number.
  • Required: The PR description must include the link to the Jira Issue, for example by completing the URL in the first checklist item
  • Required: Each commit message must be prefixed with a JIRA Issue number.
  • Issue accepted (done by Technical Committee after discussion)
  • Tests included, if applicable
  • API docs and/or User Guide docs changed or added, if applicable

Sorry, something went wrong.

Copy link
Contributor

@richgillam richgillam left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm willing to let this go in as-is, but I have a few things you might want to think about...

fuzzData.remove_prefix(sizeof(context));
icu::DateFormatSymbols::DtContextType context_mod =
static_cast<icu::DateFormatSymbols::DtContextType>(
context % icu::DateFormatSymbols::DtContextType::DT_CONTEXT_COUNT);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With both the context and the width, do you want to do the "mod" thing (or only do the "mod" thing)? It seems again that it'd be useful also to check that passing a completely illegal enum value (with, of course, you can do in C++ with casting) doesn't cause anything to barf.

dfs->getLeapMonthPatterns(count);
int32_t count2;
dfs->getZoneStrings(count, count2);
dfs->getLocalPatternChars(output);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless I'm mistaken, a DateFormatSymbols object is mutable, so you might also want to check what happens if you actually set the symbols themselves to random garbage values. Of course, the symbols object just behaves as a struct, so to really test that, you'd also have to use the bogus symbols object to format a date. (This shouldn't be a problem unless you've got really long strings, unassigned characters, illegal byte combinations, or possibly characters with unusual semantics, but it seems worth checking for all those things...)

@FrankYFTang FrankYFTang merged commit 4ba5d91 into unicode-org:main Dec 16, 2023
@FrankYFTang FrankYFTang deleted the ICU-22549-dtfmtsym-fuzzer branch December 16, 2023 00:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants