Skip to content

Commit

Permalink
ci: run the fuzz target on PRs (#4378)
Browse files Browse the repository at this point in the history
* ci: run the fuzz target on PRs

using https://google.github.io/oss-fuzz/getting-started/continuous-integration/

It downloads the corpus OSS-Fuzz has accumulated so far (including the
test cases that triggered issues in the past) and runs the fuzz target
with it. It should help to catch most regressions when PRs are opened.

Prompted by #4373.

* dcerpc: turn print into log_runtime.warning

to make it possible to turn it off with logging.disable().

(it should help to make the fuzz target less chatty among other things
because it seems to be the only dissector (covered by the fuzz target)
printing messages like that directly)
  • Loading branch information
evverx committed Jul 1, 2024
1 parent 8ed8647 commit 37d9412
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 1 deletion.
39 changes: 39 additions & 0 deletions .github/workflows/cifuzz.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: CIFuzz

on:
pull_request:
branches: [master]

permissions:
contents: read

jobs:
Fuzzing:
runs-on: ubuntu-latest
if: github.repository == 'secdev/scapy'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

steps:
- name: Build Fuzzers
id: build
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'scapy'
language: python
dry-run: false
allowed-broken-targets-percentage: 0
- name: Run Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'scapy'
language: python
dry-run: false
fuzz-seconds: 300
- name: Upload Crash
uses: actions/upload-artifact@v4
if: failure() && steps.build.outcome == 'success'
with:
name: artifacts
path: ./out/artifacts
2 changes: 1 addition & 1 deletion scapy/layers/dcerpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -3000,7 +3000,7 @@ def dispatch_hook(cls, _pkt, _underlayer=None, *args, **kargs):
for klass in cls._payload_class:
if hasattr(klass, "can_handle") and klass.can_handle(_pkt, _underlayer):
return klass
print("DCE/RPC payload class not found or undefined (using Raw)")
log_runtime.warning("DCE/RPC payload class not found or undefined (using Raw)")
return Raw

@classmethod
Expand Down

0 comments on commit 37d9412

Please sign in to comment.