From b478bf78c328b9684f6cac7f9420a823cf262d74 Mon Sep 17 00:00:00 2001 From: manunio Date: Wed, 20 Nov 2024 18:06:29 +0530 Subject: [PATCH 1/3] 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. --- .github/workflows/cifuzz.yml | 27 +++++++++++++++++++++++++++ python_multipart/multipart.py | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/cifuzz.yml diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml new file mode 100644 index 0000000..a30d324 --- /dev/null +++ b/.github/workflows/cifuzz.yml @@ -0,0 +1,27 @@ +name: CIFuzz +on: + pull_request: + branches: + - 'release/**' +jobs: + Fuzzing: + runs-on: ubuntu-latest + steps: + - name: Build Fuzzers + id: build + uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master + with: + oss-fuzz-project-name: 'python-multipart' + language: python + - name: Run Fuzzers + uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master + with: + oss-fuzz-project-name: 'python-multipart' + language: python + fuzz-seconds: 300 + - name: Upload Crash + uses: actions/upload-artifact@v3 + if: failure() && steps.build.outcome == 'success' + with: + name: artifacts + path: ./out/artifacts diff --git a/python_multipart/multipart.py b/python_multipart/multipart.py index f26a815..6c84829 100644 --- a/python_multipart/multipart.py +++ b/python_multipart/multipart.py @@ -1241,7 +1241,7 @@ def data_callback(name: CallbackName, end_i: int, remaining: bool = False) -> No elif state == MultipartState.HEADER_VALUE_ALMOST_DONE: # The last character should be a LF. If not, it's an error. if c != LF: - msg = "Did not find LF character at end of header " "(found %r)" % (c,) + msg = "Did not find LF character at end of header (found %r)" % (c,) self.logger.warning(msg) e = MultipartParseError(msg) e.offset = i From fd8a40a8dc15d44981f3b4cb322bcb7337897536 Mon Sep 17 00:00:00 2001 From: Marcelo Trylesinski Date: Fri, 10 Apr 2026 11:24:48 +0200 Subject: [PATCH 2/3] Run CIFuzz on master pushes --- .github/workflows/cifuzz.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml index 6af9409..6ec88f7 100644 --- a/.github/workflows/cifuzz.yml +++ b/.github/workflows/cifuzz.yml @@ -1,10 +1,9 @@ name: CIFuzz on: - pull_request: + push: branches: - master - - "release/**" paths: - ".github/workflows/cifuzz.yml" - "fuzz/**" From 0f3386b8e04a2771a79599dc711c8d55a7035819 Mon Sep 17 00:00:00 2001 From: Marcelo Trylesinski Date: Fri, 10 Apr 2026 11:30:12 +0200 Subject: [PATCH 3/3] Document CIFuzz workflow reference --- .github/workflows/cifuzz.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/cifuzz.yml b/.github/workflows/cifuzz.yml index 6ec88f7..7a8b28e 100644 --- a/.github/workflows/cifuzz.yml +++ b/.github/workflows/cifuzz.yml @@ -15,6 +15,7 @@ on: permissions: {} jobs: + # https://google.github.io/oss-fuzz/getting-started/continuous-integration/ Fuzzing: runs-on: ubuntu-latest