Skip to content

Commit b478bf7

Browse files
committed
fuzz: Add cifuzz
This PR adds [cifuzz](https://google.github.io/oss-fuzz/getting-started/continuous-integration/) action workflow which is a service provided by oss-fuzz where this project already runs, this helps in catching shallow bugs, regression or build breakage by running fuzzers on PR for ~5 minutes (excluding the build time) on 'release/**' branch.
1 parent 3e909f5 commit b478bf7

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

.github/workflows/cifuzz.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: CIFuzz
2+
on:
3+
pull_request:
4+
branches:
5+
- 'release/**'
6+
jobs:
7+
Fuzzing:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: Build Fuzzers
11+
id: build
12+
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
13+
with:
14+
oss-fuzz-project-name: 'python-multipart'
15+
language: python
16+
- name: Run Fuzzers
17+
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
18+
with:
19+
oss-fuzz-project-name: 'python-multipart'
20+
language: python
21+
fuzz-seconds: 300
22+
- name: Upload Crash
23+
uses: actions/upload-artifact@v3
24+
if: failure() && steps.build.outcome == 'success'
25+
with:
26+
name: artifacts
27+
path: ./out/artifacts

python_multipart/multipart.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ def data_callback(name: CallbackName, end_i: int, remaining: bool = False) -> No
12411241
elif state == MultipartState.HEADER_VALUE_ALMOST_DONE:
12421242
# The last character should be a LF. If not, it's an error.
12431243
if c != LF:
1244-
msg = "Did not find LF character at end of header " "(found %r)" % (c,)
1244+
msg = "Did not find LF character at end of header (found %r)" % (c,)
12451245
self.logger.warning(msg)
12461246
e = MultipartParseError(msg)
12471247
e.offset = i

0 commit comments

Comments
 (0)