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

Introduce toggle for FuzzedDataProvider to only return printable strings #268

Merged
merged 1 commit into from
Jan 25, 2023

Conversation

0xricksanchez
Copy link
Contributor

@0xricksanchez 0xricksanchez commented Jan 10, 2023

The change aims at being able to toggle this individually for each time we call a ConsumeStr* method, which would allow us to pass lossy strings and proper ASCII strings as function inputs, instead of globally toggling ASCII-only mutations by setting the appropriate libfuzzer flag and/or using the constructor for the FuzzedDataProvider

Instead of just filtering out non-printable ones and having to re-read from the data buffer (multiple times) I opted for a (hopefully lightweight) conversion, so that each non-printable one is converted into a printable one.

@0xricksanchez 0xricksanchez marked this pull request as draft January 10, 2023 16:38
@0xricksanchez 0xricksanchez marked this pull request as ready for review January 10, 2023 17:49
@0xricksanchez 0xricksanchez force-pushed the FUZZ-490_enforce_printable_string branch from 3cd5c13 to 5f1a5fa Compare January 10, 2023 17:51
@0xricksanchez 0xricksanchez changed the title Introduce toggle that returns only printable strings from the FuzzedDataProvider Introduce toggle for FuzzedDataProvider to only return printable strings Jan 11, 2023
@0xricksanchez 0xricksanchez marked this pull request as draft January 11, 2023 15:05
@0xricksanchez 0xricksanchez force-pushed the FUZZ-490_enforce_printable_string branch from 2d9ceec to dbbcdfe Compare January 12, 2023 08:57
@0xricksanchez 0xricksanchez force-pushed the FUZZ-490_enforce_printable_string branch from 7ba43c0 to c3addb6 Compare January 24, 2023 14:22
@0xricksanchez 0xricksanchez marked this pull request as ready for review January 24, 2023 14:32
Copy link
Contributor

@oetr oetr left a comment

Choose a reason for hiding this comment

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

Good job, thanks!

packages/core/FuzzedDataProvider.ts Outdated Show resolved Hide resolved
packages/core/FuzzedDataProvider.ts Outdated Show resolved Hide resolved
packages/core/FuzzedDataProvider.ts Outdated Show resolved Hide resolved
@0xricksanchez
Copy link
Contributor Author

@oetr What do you think of this approach, which should yield a more uniform distribution when converting to ASCII printable?

@0xricksanchez 0xricksanchez force-pushed the FUZZ-490_enforce_printable_string branch from 278f6eb to 4791123 Compare January 25, 2023 19:19
@0xricksanchez 0xricksanchez enabled auto-merge (squash) January 25, 2023 19:19
@0xricksanchez 0xricksanchez merged commit 97f31ba into main Jan 25, 2023
@0xricksanchez 0xricksanchez deleted the FUZZ-490_enforce_printable_string branch January 25, 2023 19:39
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