Files
DomiStream/fuzz/Cargo.toml
mnovak db56a5dbb1 [fuzz] enet_host and control_host targets
enet_host: accept on the first datagram or a canned connect (optionally acknowledged), then datagrams, some with our header; asserts outgoing datagrams parse within the MTU and deliveries stay under the cap. control_host: a connected ControlHost fed sealed arbitrary plaintexts, replayed sequence numbers, arbitrary frames in valid commands and raw datagrams; asserts parse_client_message invariants and that no message appears without a sealed frame. 60 s each, 0 crashes.
2026-12-04 12:46:39 +01:00

252 lines
4.8 KiB
TOML

# Fuzz targets: one per DomiStream parser and state machine; each asserts invariants (round trips, caps). Its own workspace, built only for fuzzing, never released.
#
# Linux, nightly, cargo-fuzz:
# cargo fuzz run <target> -- -max_total_time=600
#
# Windows, stable MSVC, no cargo-fuzz, no sanitizer (same setup as Via's via-core/fuzz): build.rs + win_sections.c
# give SanitizerCoverage's counters their section bounds, so the targets link without a sanitizer runtime.
# cd fuzz
# RUSTFLAGS="-Cpasses=sancov-module -Cllvm-args=-sanitizer-coverage-level=4
# -Cllvm-args=-sanitizer-coverage-inline-8bit-counters -Cllvm-args=-sanitizer-coverage-trace-compares
# -Cllvm-args=-simplifycfg-branch-fold-threshold=0 -Ccodegen-units=1 --cfg fuzzing -Cdebug-assertions
# -Clink-arg=/include:main" \
# cargo build --release --target x86_64-pc-windows-msvc --bin <target>
# target/x86_64-pc-windows-msvc/release/<target>.exe -max_total_time=600 corpus/<target>
# A plain `cargo build` here does not link on Windows (LNK1561: libFuzzer's `main` needs `/include:main`); use the
# RUSTFLAGS above. Checked 2026-11-25: enet_datagram built this way ran 12,183,242 inputs in 11 s.
# corpus/ and artifacts/ stay out of git. Never set CARGO_TARGET_DIR.
[package]
name = "domistream-fuzz"
version = "0.0.0"
edition = "2024"
publish = false
license = "CPAL-1.0"
[package.metadata]
cargo-fuzz = true
[build-dependencies]
cc = "1"
[dependencies]
libfuzzer-sys = "0.4"
domistream = { path = "../crates/domistream" }
# Its own workspace, so the fuzz build never joins the main one (cargo fuzz's layout).
[workspace]
members = ["."]
[[bin]]
name = "xml"
path = "fuzz_targets/xml.rs"
test = false
doc = false
bench = false
[[bin]]
name = "server_info"
path = "fuzz_targets/server_info.rs"
test = false
doc = false
bench = false
[[bin]]
name = "app_list"
path = "fuzz_targets/app_list.rs"
test = false
doc = false
bench = false
[[bin]]
name = "launch_response"
path = "fuzz_targets/launch_response.rs"
test = false
doc = false
bench = false
[[bin]]
name = "pair_response"
path = "fuzz_targets/pair_response.rs"
test = false
doc = false
bench = false
[[bin]]
name = "server_cert_pem"
path = "fuzz_targets/server_cert_pem.rs"
test = false
doc = false
bench = false
[[bin]]
name = "rtsp_response"
path = "fuzz_targets/rtsp_response.rs"
test = false
doc = false
bench = false
[[bin]]
name = "rtsp_request"
path = "fuzz_targets/rtsp_request.rs"
test = false
doc = false
bench = false
[[bin]]
name = "sdp"
path = "fuzz_targets/sdp.rs"
test = false
doc = false
bench = false
[[bin]]
name = "rtsp_framer"
path = "fuzz_targets/rtsp_framer.rs"
test = false
doc = false
bench = false
[[bin]]
name = "enet_datagram"
path = "fuzz_targets/enet_datagram.rs"
test = false
doc = false
bench = false
[[bin]]
name = "control_frame"
path = "fuzz_targets/control_frame.rs"
test = false
doc = false
bench = false
[[bin]]
name = "control_message"
path = "fuzz_targets/control_message.rs"
test = false
doc = false
bench = false
[[bin]]
name = "input"
path = "fuzz_targets/input.rs"
test = false
doc = false
bench = false
[[bin]]
name = "rtp_header"
path = "fuzz_targets/rtp_header.rs"
test = false
doc = false
bench = false
[[bin]]
name = "video_packet"
path = "fuzz_targets/video_packet.rs"
test = false
doc = false
bench = false
[[bin]]
name = "audio_packet"
path = "fuzz_targets/audio_packet.rs"
test = false
doc = false
bench = false
[[bin]]
name = "server_cert_der"
path = "fuzz_targets/server_cert_der.rs"
test = false
doc = false
bench = false
[[bin]]
name = "enet_client"
path = "fuzz_targets/enet_client.rs"
test = false
doc = false
bench = false
[[bin]]
name = "media_decrypt"
path = "fuzz_targets/media_decrypt.rs"
test = false
doc = false
bench = false
[[bin]]
name = "video_depacketizer"
path = "fuzz_targets/video_depacketizer.rs"
test = false
doc = false
bench = false
[[bin]]
name = "audio_depacketizer"
path = "fuzz_targets/audio_depacketizer.rs"
test = false
doc = false
bench = false
[[bin]]
name = "fec_reconstruct"
path = "fuzz_targets/fec_reconstruct.rs"
test = false
doc = false
bench = false
[[bin]]
name = "pairing_session"
path = "fuzz_targets/pairing_session.rs"
test = false
doc = false
bench = false
[[bin]]
name = "rtsp_client"
path = "fuzz_targets/rtsp_client.rs"
test = false
doc = false
bench = false
[[bin]]
name = "video_packetizer_roundtrip"
path = "fuzz_targets/video_packetizer_roundtrip.rs"
test = false
doc = false
bench = false
[[bin]]
name = "enet_host"
path = "fuzz_targets/enet_host.rs"
test = false
doc = false
bench = false
[[bin]]
name = "rtsp_server"
path = "fuzz_targets/rtsp_server.rs"
test = false
doc = false
bench = false
[[bin]]
name = "announce"
path = "fuzz_targets/announce.rs"
test = false
doc = false
bench = false
test = false
doc = false
bench = false
[[bin]]
name = "control_host"
path = "fuzz_targets/control_host.rs"
test = false
doc = false
bench = false