Fuzzer definitions, seed corpora and dictionaries to fuzz-test the stdlib
Find a file
2025-12-09 20:19:36 -06:00
corp-csv Add more fuzzers 2019-07-05 19:40:31 +02:00
corp-decode Add more fuzzers 2019-07-05 19:40:31 +02:00
corp-difflib Add more fuzzers 2019-07-05 19:40:31 +02:00
corp-email Add all 2019-07-03 01:22:57 +02:00
corp-html Add all 2019-07-03 01:22:57 +02:00
corp-httpclient Add all 2019-07-03 01:22:57 +02:00
corp-json Add all 2019-07-03 01:22:57 +02:00
corp-tarfile Add seed corpora for tarfile 2025-11-07 15:28:56 -06:00
corp-xml Add fuzzer for xml.etree parser 2025-12-09 20:19:36 -06:00
corp-zipfile Add seed corpora for ZIP 2025-11-07 13:53:39 -06:00
ast.py AST fuzzer: Don't print warnings and unparse the AST 2022-12-18 06:29:19 +01:00
configparser.py Add 3 more fuzzers: plist, toml and config 2023-04-26 13:57:36 +02:00
csv.py Add more fuzzers 2019-07-05 19:40:31 +02:00
decode.py Add more fuzzers 2019-07-05 19:40:31 +02:00
difflib.py Add more fuzzers 2019-07-05 19:40:31 +02:00
email.py Add all 2019-07-03 01:22:57 +02:00
fuzzer-ast.dict Add dictionary for fuzzer-ast 2022-06-16 13:24:23 +02:00
fuzzer-decode.dict Add dictionary for fuzzer-decode 2019-07-05 19:41:59 +02:00
fuzzer.cpp Fix build 2023-06-04 19:23:44 +02:00
html.py Add all 2019-07-03 01:22:57 +02:00
httpclient.py Add all 2019-07-03 01:22:57 +02:00
json.py Add all 2019-07-03 01:22:57 +02:00
LICENSE Create LICENSE 2019-07-03 01:21:43 +02:00
Makefile Add fuzzer for xml.etree parser 2025-12-09 20:19:36 -06:00
plist.py Add more allowed error conditions to plist, tarfile, and zipfile fuzzers 2025-11-05 14:24:05 -06:00
python_coverage.h Fix build 2022-11-23 08:13:29 +01:00
re.py Fix the re and tarfile fuzzers 2023-04-25 22:21:12 +02:00
README.md Update repo URLs for new home 2025-11-17 15:04:23 +00:00
tarfile.py Add tarfile data filter extract test 2025-11-10 09:45:37 -06:00
tomllib.py Add 3 more fuzzers: plist, toml and config 2023-04-26 13:57:36 +02:00
xml.py Add fuzzer for xml.etree parser 2025-12-09 20:19:36 -06:00
zipfile.py Add check for relative extraction 2025-11-07 13:53:50 -06:00

Python Library Fuzzers

This repository contains the fuzzer definitions, seed corpora, and dictionaries used by OSS-Fuzz to fuzz-test Python standard library modules.

Getting Started

Read the getting started guide for OSS-Fuzz to learn about the architecture of the fuzzer and the necessary dependencies for local development (Docker, Python).

Architecture

There are four components of the OSS-Fuzz architecture hosted in this repository. Other components of the OSS-Fuzz architecture are hosted in other repositories.

Components that are hosted in this repository:

  • Fuzz target definitions. These are typically .py files that are bootstrapped into binaries by fuzzer.cpp and Makefile.
  • Fuzz seed corpora (corp-*): These files contain "starting points" byte sequences that the fuzzer can use to get results quicker than random bytes.
  • Fuzz dictionaries (*.dict): These files contain possible byte sequences that the fuzzer can use when mutating input sequences.
  • Coverage header file (python_coverage.h): This file is compiled with CPython so that line coverage is tracked over time as the fuzzer executes.

Components that are hosted elsewhere:

When you create a new fuzz target don't forget to add the target to the fuzzer image so that the fuzz target is executed by OSS-Fuzz.

Local development

To do develop locally with OSS-Fuzz you need to fork and clone the following repositories:

After cloning forks of these repositories, move into the oss-fuzz repository and run the following to build the base and fuzzer image:

python infra/helper.py build_image python3-libraries
python infra/helper.py build_fuzzers python3-libraries

Once this succeeds you have the proper toolset to locally develop fuzzers. You can run fuzz targets using the same helper script:

python infra/helper.py run_fuzzer python3-libraries fuzzer-email

This will run the fuzzer indefinitely, so stop the fuzzer whenever you've confirmed that it works. Now we need to point the oss-fuzz repository to our own forks to start local development.

Modify the projects/python3-libraries/Dockerfile file git clone lines to point to your own forks (example below using sethmlarson). It's recommended to use a branch on forks instead of main, so the example below also uses --branch fork-branch which you can change to your own branch depending on which repository you are modifying during development.

-RUN git clone https://github.com/python/cpython.git cpython
-RUN git clone --depth 1 https://github.com/python/library-fuzzers.git
+RUN git clone --depth 1 --branch fork-branch https://github.com/sethmlarson/cpython.git cpython
+RUN git clone --depth 1 --branch fork-branch https://github.com/sethmlarson/library-fuzzers.git

After this you can now re-run the python infra/helper.py commands to rebuild the image and fuzzers using the fork repositories instead. From here local development proceeds through pushing commits to your fork branches, rebuilding the image and fuzzers, and then running the fuzzers.