Skip to content

Add libFuzzer harness for PAC parsing#246

Open
Tushar98644 wants to merge 1 commit into
manugarg:mainfrom
Tushar98644:add-libfuzzer-harness
Open

Add libFuzzer harness for PAC parsing#246
Tushar98644 wants to merge 1 commit into
manugarg:mainfrom
Tushar98644:add-libfuzzer-harness

Conversation

@Tushar98644

Copy link
Copy Markdown

Adds a libFuzzer target under fuzz/ that exercises the PAC parsing path. It drives pacparser_parse_pac_string() followed by pacparser_find_proxy(), so it covers pacparser's own C layer and the PAC helper functions (myIpAddress, dnsResolve, isInNet, shExpMatch, ...) on top of the embedded QuickJS engine.

What's included

  • fuzz/fuzz_pac.c — the harness. Each input is split on NUL bytes into <pac script>\0<url>\0<host>, with fixed defaults for missing fields, so a bare PAC script is also a valid input.
  • fuzz/build.sh — ASan + libFuzzer build. Honours $CC, $CFLAGS, and $LIB_FUZZING_ENGINE, so it drops straight into an OSS-Fuzz build.sh with no changes.
  • fuzz/corpus/ — a few readable PAC seeds covering distinct helper paths.
  • fuzz/README.md — build/run notes (incl. using Homebrew LLVM on macOS, since Apple's stock clang doesn't ship libFuzzer).

Notes

  • No library code is changed — this only adds the fuzz/ directory.
  • Build artifacts are git-ignored via fuzz/.gitignore.

Built and run locally with CC=<llvm>/clang ./fuzz/build.sh (ASan + libFuzzer); the harness builds clean and runs against the seed corpus.

Adds a libFuzzer target under fuzz/ that drives pacparser_parse_pac_string()
followed by pacparser_find_proxy(), exercising the library's C layer and the
PAC helper functions (myIpAddress, dnsResolve, isInNet, shExpMatch, ...) on
top of the embedded QuickJS engine.

- fuzz/fuzz_pac.c: harness; input is NUL-split into <script>\0<url>\0<host>
- fuzz/build.sh: ASan + libFuzzer build; honours $CC/$CFLAGS/$LIB_FUZZING_ENGINE
  so it drops straight into an OSS-Fuzz build.sh
- fuzz/corpus: a few readable PAC seeds covering distinct helper paths
- fuzz/README.md: build/run notes (incl. Homebrew LLVM on macOS)

No library code is changed.
@Tushar98644
Tushar98644 force-pushed the add-libfuzzer-harness branch from c4080cc to 46c1573 Compare June 29, 2026 07:04
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