Files
craft-libs/crates/image-codecs/fuzz/Cargo.toml
FredApps 9399c25341 image-codecs: decode AVIF pixels with craft-video's pure-Rust AV1 decoder
New optional `avif-decode` feature (native targets) reads still AVIF
files: the HEIF/ISOBMFF item graph, grids, clap/irot/imir, alpha
auxiliary images (including premultiplied), 8/10/12-bit 4:0:0, 4:2:0,
4:2:2 and 4:4:4, nclx/ICC colour, Exif and XMP, and PQ/HLG to linear
F32 through cicp::linearize as the HEIF path does.

The container walk follows LightCraft #3017 by @emmertex. Every size is
checked against the caller's Limits before the AV1 decoder runs, the
decoder's memory budget is capped by max_alloc, and the decode is
wrapped in catch_unwind so a decoder panic becomes an error.

Fixtures are tiny ffmpeg/libaom files; the 4:2:0 planes match libdav1d
bit for bit. Adds a decode_avif fuzz target.

Part of storytold/craft-libs#778.
2026-11-15 16:10:22 +01:00

86 lines
1.5 KiB
TOML

[package]
name = "craft-image-codecs-fuzz"
version = "0.0.0"
publish = false
edition = "2024"
license = "MIT OR Apache-2.0"
[package.metadata]
cargo-fuzz = true
# Standalone workspace so the main workspace's `crates/*` glob and lints do
# not apply (cargo-fuzz needs nightly + sanitizer flags).
[workspace]
[dependencies]
libfuzzer-sys = "0.4"
craft-image-codecs = { path = "..", features = ["heif", "avif-decode"] }
# Called directly too: the codec turns its panics into errors (see decode_heif.rs).
heic-rs = "=0.1.4"
[profile.release]
debug = 1
[[bin]]
name = "decode_any"
path = "fuzz_targets/decode_any.rs"
test = false
doc = false
bench = false
[[bin]]
name = "decode_png"
path = "fuzz_targets/decode_png.rs"
test = false
doc = false
bench = false
[[bin]]
name = "decode_jpeg"
path = "fuzz_targets/decode_jpeg.rs"
test = false
doc = false
bench = false
[[bin]]
name = "decode_tiff"
path = "fuzz_targets/decode_tiff.rs"
test = false
doc = false
bench = false
[[bin]]
name = "decode_exr"
path = "fuzz_targets/decode_exr.rs"
test = false
doc = false
bench = false
[[bin]]
name = "decode_heif"
path = "fuzz_targets/decode_heif.rs"
test = false
doc = false
bench = false
[[bin]]
name = "decode_gif"
path = "fuzz_targets/decode_gif.rs"
test = false
doc = false
bench = false
[[bin]]
name = "decode_webp"
path = "fuzz_targets/decode_webp.rs"
test = false
doc = false
bench = false
[[bin]]
name = "decode_avif"
path = "fuzz_targets/decode_avif.rs"
test = false
doc = false
bench = false