Skip to content

Fuzz

Fuzz #11

Workflow file for this run

name: Fuzz
# Nightly rather than per-PR: libFuzzer needs minutes to be worth anything,
# and a finding is a bug that existed regardless of which PR was open. The
# committed corpus keeps every past discovery replaying instantly.
on:
schedule:
- cron: '30 4 * * *'
workflow_dispatch:
inputs:
seconds:
description: 'Seconds per target'
default: '600'
permissions:
contents: read
jobs:
fuzz:
name: ${{ matrix.target }}
runs-on: ubuntu-latest
timeout-minutes: 30
env:
# libFuzzer needs the -Z flags only nightly accepts, and installing a
# nightly toolchain is not enough to get one: rustup resolves
# rust-toolchain.toml over whatever the action installed, so every run of
# this job since it was written died on `the option Z is only accepted on
# the nightly compiler` before fuzzing a byte. RUSTUP_TOOLCHAIN outranks
# the file and is inherited by the cargo that cargo-fuzz spawns.
RUSTUP_TOOLCHAIN: nightly
strategy:
fail-fast: false
matrix:
target: [codec, keys, range]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- uses: dtolnay/rust-toolchain@6bed0761d98439e5a578e2877258200ad565ba87 # stable
with:
toolchain: nightly
- name: Install cargo-fuzz
run: cargo install cargo-fuzz --locked
- name: Fuzz
env:
SECONDS: ${{ inputs.seconds || '600' }}
run: |
cargo fuzz run "${{ matrix.target }}" -- \
-max_total_time="$SECONDS" \
-timeout=30 \
-rss_limit_mb=4096
- name: Keep the crashing input
if: failure()
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4 # v5
with:
name: fuzz-artifacts-${{ matrix.target }}
path: fuzz/artifacts/
if-no-files-found: ignore