Skip to content

Commit 497fee8

Browse files
authored
reword fuzz README.md
1 parent cdee552 commit 497fee8

File tree

1 file changed

+29
-27
lines changed

1 file changed

+29
-27
lines changed

tests/fuzz/README.md

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,41 @@
1-
# Fuzzing by way of OSS-Fuzz
1+
# OSS-Fuzz integration
22

3-
Fuzzing set up that is run by OSS-Fuzz. The relevant files in the OSS-Fuzz
4-
repository is [here](https://github.com/google/oss-fuzz/tree/master/projects/markdown-it-py).
3+
In principle, core Markdown parsing is designed to never except/crash on any input,
4+
and so [fuzzing](https://en.wikipedia.org/wiki/Fuzzing) can be used to test this conformance.
5+
This folder contains fuzzers which are principally run downstream as part of the <https://github.com/google/oss-fuzz> infrastructure.
56

6-
The fuzzers require the [Atheris](https://pypi.org/project/atheris/) package.
7-
You need this package to run the fuzzers locally (i.e. non oss-fuzz).
7+
Any file that matches `fuzz_*.py` in this repository will be built and run on OSS-Fuzz
8+
(see <https://github.com/google/oss-fuzz/blob/master/projects/markdown-it-py/build.sh>).
89

9-
## Building by way of OSS-Fuzz
10-
The following steps will build the fuzzers using the OSS-Fuzz infrastructure:
11-
```
12-
git clone https://github.com/google/oss-fuzz
13-
cd oss-fuzz
14-
python3 infra/helper.py build_fuzzers markdown-it-py
10+
See <https://google.github.io/oss-fuzz/advanced-topics/ideal-integration> for full details.
1511

16-
# The fuzzers are now placed in build/out/markdown-it-py
17-
# To run the fuzz_markdown fuzzer:
18-
python3 infra/helper.py run_fuzzer markdown-it-py fuzz_markdown
19-
```
12+
## CI integration
13+
14+
Fuzzing essentially runs forever, or until a crash is found, therefore it cannot be fully integrated into local continous integration testing.
15+
The workflow in `.github/workflows/fuzz.yml` though runs a brief fuzzing on code changed in a PR,
16+
which can be used to provide early warning on code changes.
17+
18+
## Reproducing crash failures
2019

21-
## Extending so fuzzers run on OSS-Fuzz
22-
The build script on the OSS-Fuzz repository for markdown-it-py fuzzers is
23-
here: https://github.com/google/oss-fuzz/blob/master/projects/markdown-it-py/build.sh
20+
If OSS-Fuzz (or the CI workflow) identifies a crash, it will produce a "minimized testcase" file
21+
(e.g. <https://oss-fuzz.com/testcase-detail/5424112454729728>).
22+
23+
To reproduce this crash locally, the easiest way is to run the [tox](https://tox.wiki/) environment, provided in this repository, against the test file (see `tox.ini`):
24+
25+
```
26+
tox -e fuzz path/to/testcase
27+
```
2428

25-
Any file that matches `fuzz_*.py` in this repository will be build and run on
26-
OSS-Fuzz. Thus, to extend with a new fuzzer simply name it accordingly.
29+
This idempotently sets up a local python environment with markdown-it-py (local dev) and [Atheris](https://pypi.org/project/atheris/) installed,
30+
clones <https://github.com/google/oss-fuzz> into it,
31+
and builds the fuzzers.
32+
Then the testcase is run within this environment.
2733

28-
## Reproducing issues
29-
In order to reproduce an issue reported by OSS-Fuzz, you need to:
30-
1) Download the `Minimized Testcase` (which is a file or raw bytes) from the
31-
detailed OSS-Fuzz reports. Example link: https://oss-fuzz.com/testcase-detail/5424112454729728
32-
2) Build the fuzzers as shown above
33-
3) Use the command:
34+
If you wish to simply run the full fuzzing process,
35+
you can activate this environment, then run e.g.:
3436

3537
```
36-
python3 infra/helper.py reproduce markdown-it-py {FUZZER_NAME} {PATH_TO_MINIMIZED_TESTCASE}
38+
python .tox/fuzz/oss-fuzz/infra/helper.py run_fuzzer markdown-it-py fuzz_markdown
3739
```
3840

3941
For a more thorough guide on reproducing, see: https://google.github.io/oss-fuzz/advanced-topics/reproducing/

0 commit comments

Comments
 (0)