Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
name: Fuzz

# Coverage-guided fuzzing of the two parsers of zone bytes (docs/design/broker.md), weekly on a pinned nightly.
# A pull request that touches their code builds both targets without fuzzing them, so a new request
# variant the harness does not match fails there, not on the next weekly run.

on:
schedule:
- cron: '0 4 * * 0'
workflow_dispatch:
pull_request:
paths:
- 'compartments/kryptikd/src/**'
- 'compartments/kryptikd/fuzz/**'
- 'compositor/wlproxy/**'
- '.github/workflows/fuzz.yml'

permissions:
contents: read
Expand Down Expand Up @@ -59,8 +67,14 @@ jobs:
fi
echo "$(find "$RUNNER_TEMP/corpus" -type f | wc -l) seeds"

- name: The target builds
if: github.event_name == 'pull_request'
working-directory: ${{ matrix.dir }}
run: cargo fuzz build --sanitizer none "$FUZZ_TARGET"

# Safe Rust throughout, so no sanitizer: panics, overflow checks and the harness's asserts are the oracle.
- name: Twenty minutes of fuzzing
if: github.event_name != 'pull_request'
working-directory: ${{ matrix.dir }}
run: cargo fuzz run --sanitizer none "$FUZZ_TARGET" "$RUNNER_TEMP/corpus" -- -max_total_time=1200 -max_len="$MAX_LEN" -timeout=10 -print_final_stats=1

Expand Down
2 changes: 1 addition & 1 deletion compartments/kryptikd/fuzz/broker_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fuzz_target!(|data: &[u8]| {
let Some(nl) = data.iter().position(|b| *b == b'\n') else { return };
let header = String::from_utf8_lossy(&data[..nl]);
match parse_request(&header) {
Err(_) | Ok(Request::Version | Request::ClipboardGet | Request::UpdatePoll) => {}
Err(_) | Ok(Request::Version | Request::ClipboardGet | Request::UpdatePoll | Request::Stick) => {}
Ok(Request::ClipboardSet { mime, len }) => assert!(MIME_TYPES.contains(&mime.as_str()) && len <= CLIPBOARD_MAX),
Ok(Request::Transfer { dest, name }) => {
assert!((1..=12).contains(&dest.len()));
Expand Down
Loading