Skip to content

Ensure "parse" fuzz target covers all options#980

Merged
Martin1887 merged 1 commit intopulldown-cmark:masterfrom
ollpu:fuzz-all-options
Nov 6, 2024
Merged

Ensure "parse" fuzz target covers all options#980
Martin1887 merged 1 commit intopulldown-cmark:masterfrom
ollpu:fuzz-all-options

Conversation

@ollpu
Copy link
Collaborator

@ollpu ollpu commented Nov 6, 2024

The fuzz target parse.rs (intended to find crashes/panics) was missing some newer options.

Change to use Options::from_bits_truncate to generate arbitrary combinations of all options, current and future.

Not sure if the field order in the struct makes much difference, but I figured it's better to have the fixed length field first, so it doesn't move around and change unintentionally.

Tried it out, and it found #973 in under a minute (on v0.12.2 before the fix was merged).

@Martin1887 Martin1887 merged commit d9b3a5f into pulldown-cmark:master Nov 6, 2024
@Martin1887
Copy link
Collaborator

Nice!

@ollpu
Copy link
Collaborator Author

ollpu commented Nov 6, 2024

Forgot to mention this does preclude using the -only_ascii=1 flag with libfuzzer (all option combinations were possible when they were bools but now they're not). Shouldn't make much difference, but I haven't played with it that much either.

@ollpu
Copy link
Collaborator Author

ollpu commented Nov 6, 2024

@kdarkhan in the README example you had put -only_ascii=1. Have you found that to be helpful?

If we really wanted, it could be supported while keeping this option-agnostic via something like [bool; Options::all().bits().count_ones()].

@kdarkhan
Copy link
Contributor

kdarkhan commented Nov 6, 2024

I haven't really tested it much with fuzzing this project. I put the option only as an example of fixing the build and not as the suggested option. Feel free to remove it if it is misleading now.

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.

3 participants