Skip to content

Conversation

riesentoaster
Copy link
Contributor

Description

Sometimes, one needs access to state (e.g. for its RNG) in a mapper. StateAwareMappingMutator provides this functionality.

This PR also creates user-friendly functions to use it with havoc and numeric mutators, and adds example code to the demo fuzzer.

Checklist

  • I have run ./scripts/precommit.sh and addressed all comments

@riesentoaster
Copy link
Contributor Author

(CI failures seem unrelated)

@domenukk
Copy link
Member

#3454 should fix the CI

///
/// Allows using [`Mutator`]s for a certain type on (parts of) other input types that can be mapped to this type.
///
/// For a more flexible alternative, which allows access to `state`, see [`StateAwareMappingMutator`].
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason not to always use the StateAware version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not really, besides having to ignore parameters and having to wrap your results in Some.

Copy link
Member

Choose a reason for hiding this comment

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

So can we get rid of some duplicate code or should I just merge? :D

@domenukk domenukk merged commit 5af963c into AFLplusplus:main Oct 20, 2025
109 checks passed
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