Skip to content

Add libFuzzer harnesses for parser, loader, scanner and emitter APIs#327

Open
VAHPEM wants to merge 1 commit into
yaml:masterfrom
VAHPEM:add-libfuzzer-harnesses
Open

Add libFuzzer harnesses for parser, loader, scanner and emitter APIs#327
VAHPEM wants to merge 1 commit into
yaml:masterfrom
VAHPEM:add-libfuzzer-harnesses

Conversation

@VAHPEM
Copy link
Copy Markdown

@VAHPEM VAHPEM commented Mar 24, 2026

This PR adds experimental libFuzzer harnesses for several libyaml APIs.

Included targets:

  • yaml_parser_scan()
  • yaml_parser_parse()
  • yaml_parser_load()
  • yaml_emitter_emit()
  • nested emitter harness
  • parse → emit round-trip harness

Local fuzzing experiments show high parser-side coverage:

parser.c ≈ 92.9% line coverage
reader.c ≈ 94.8% line coverage
scanner.c ≈ 94.0% line coverage

The round-trip harness significantly improves emitter exploration:

emitter.c ≈ 85.3% line coverage

These harnesses may also serve as a starting point for future fuzzing
integration (for example OSS-Fuzz or similar continuous fuzzing setups).

A README in the fuzz/ directory documents the harnesses and the coverage
observations.

An example round-trip edge case discovered during early experimentation is
included for reference.

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