Skip to content

[dev.fuzz] internal/fuzz: mutator should generate valid UTF-8 for strings #46874

Closed
@jayconrod

Description

@jayconrod

Currently, we use the same mutation engine for string and []byte. This tends to generate a lot of invalid UTF-8 strings that aren't usable for many use cases. While invalid UTF-8 is likely to turn up many shallow parser bugs, it may make the mutator less effective at finding more subtle, deeper bugs.

We should have an option to make the mutator only generate UTF-8. Some ideas:

  • Create a UTF8String defined type. A fuzz function that accepts that as a parameter would only get valid UTF-8 strings.
  • Only provide valid UTF-8 strings for string parameters. A function could request []byte for random bytes, and that can still be converted to string.

cc @golang/fuzzing @findleyr

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsDecisionFeedback is required from experts, contributors, and/or the community before a change can be made.fuzzIssues related to native fuzzing support

    Type

    No type

    Projects

    Status

    No status

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions