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

tests(fuzz): Add parse_duration fuzzing target #1129

Merged
merged 1 commit into from
Aug 23, 2024

Conversation

caspermeijn
Copy link
Collaborator

Add a fuzzing target for parsing into a Duration.

@caspermeijn
Copy link
Collaborator Author

@mumbleskates This is the other fuzzer I used for my testing. Do you have suggestions?

Copy link
Contributor

@mumbleskates mumbleskates left a comment

Choose a reason for hiding this comment

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

this looks pretty good. in the fuzzer i have committed so far i also added some regex that helps assert that anything we successfully parsed actually looks reasonable and like we expect, so we don't end up accidentally parsing something that looks really strange. for this case that should be a super simple pattern.

fuzz/fuzzers/parse_duration.rs Outdated Show resolved Hide resolved
Add a fuzzing target for parsing into a Duration.
@caspermeijn
Copy link
Collaborator Author

this looks pretty good. in the fuzzer i have committed so far i also added some regex that helps assert that anything we successfully parsed actually looks reasonable and like we expect, so we don't end up accidentally parsing something that looks really strange. for this case that should be a super simple pattern.

I found that the regex made the test less readable. If we can roundtrip the text, then it can't be that strange, right?

@caspermeijn caspermeijn added this pull request to the merge queue Aug 23, 2024
Merged via the queue into tokio-rs:master with commit 0c79864 Aug 23, 2024
16 checks passed
@caspermeijn caspermeijn deleted the fuzz_duration branch August 23, 2024 09:15
@mumbleskates
Copy link
Contributor

that is a reasonable enough logic! i find regex pretty tractable personally but that obviously varies wildly from person to person. works great without it 👍

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.

2 participants