Files
mnovak 948f446a13 [domistream] Tests: fuzz targets assert invariants
Every target now checks properties instead of only calling the parser:
parse -> encode -> parse stability (RTSP request, ENet, input), caps and
TooLarge past them, chunking invariance of the framer, XML vs status parser
agreement, seal/open round trips, no forged GCM tags. New targets for the
parsers and state machines that had none: server_cert_der, enet_client,
media_decrypt, video_depacketizer, audio_depacketizer, fec_reconstruct,
pairing_session, rtsp_client (25 targets).
2026-11-25 12:51:08 +01:00

214 lines
4.2 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