Skip to content

feat: add fuzzing example and documentation - #469

Open
Pastalikek65 wants to merge 1 commit into
alecthomas:masterfrom
Pastalikek65:fix-204-fuzzing
Open

feat: add fuzzing example and documentation#469
Pastalikek65 wants to merge 1 commit into
alecthomas:masterfrom
Pastalikek65:fix-204-fuzzing

Conversation

@Pastalikek65

Copy link
Copy Markdown

Partially addresses #204

Grammar-driven generation (parser.Fuzz(&ast) producing random valid strings) would be a larger project — it needs a regex-to-string generator in the lexer to invert captures. This PR instead delivers the immediately useful half of the request: an official, ready-to-run native Go fuzz target for participle parsers.

Changes:

  • fuzz_test.go: FuzzParse — a concrete example target that exercises a grammar with arbitrary input (panic/hang detection), with a seed corpus that also runs in CI as a regular test
  • README.md: new "Fuzzing" section explaining the pattern and usage (go test -fuzz=FuzzParse -fuzztime 30s ./...)

If grammar-driven generation is still desired, it would fit well as a separate issue with a design for a lexer.Pattern → string generator.

Provides a ready-to-run native Go fuzz target for participle parsers,
demonstrating how any grammar can be fuzzed for panics and hangs, plus a
Fuzzing section in the README and a seed corpus that also runs in CI.
Partially addresses alecthomas#204.
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.

1 participant