//! Structured fuzz over multipart part geometry. //! //! Row 7 of `astra-soak-overview` (upload + object path), and the fourth //! target built there. The doors were counted before this was //! written, as infra `8910f917` instructs, and the count decided the shape: //! almost all of `s3-storage` is async I/O against a live endpoint and is not //! fuzzable without one, while `MultipartPlan` is pure arithmetic with four //! call sites in MNW server and one implementation behind them. //! //! `MultipartPlan`'s docs say the client computes the same boundaries //! independently, which reads like the two-parsers shape that made a shared //! crate the answer for `git_ssh`. It is not: SyncKit's check is a one-line //! restatement (`size_bytes.div_ceil(part_size) == part_count`), so a //! differential would measure nothing the property does not. The property is //! asserted instead, and it is the first thing `oracle::check_plan` checks. //! //! ## Why this path is worth a target //! //! It is what creator media travels through, and it fails in two directions. //! Parts that do not tile the object exactly mean corrupted or truncated media, //! invisible until playback. A plan refused when it should not be means a //! legitimate upload rejected. The oracle asserts both, which is why it checks //! the error paths as tightly as the success path. #![no_main] use libfuzzer_sys::fuzz_target; /// S3's own bounds, restated so the shaped call below always lands inside them. const MIN_PART: u64 = 5 * 1024 * 1024; const MAX_PART: u64 = 5 * 1024 * 1024 * 1024; fuzz_target!(|input: (u64, u64)| { let (total_size, raw_part) = input; // The raw pair, which is mostly refusals. Worth running: "every rejection // names a condition that actually holds" is half of what the oracle // asserts, and it is the half that protects legitimate uploads. s3_storage::oracle::check_plan(total_size, raw_part as usize); // A part size guaranteed inside S3's window, so the success path is // exercised on every input rather than only when random bytes happen to // land in a range that is a vanishing fraction of u64. let shaped = MIN_PART + (raw_part % (MAX_PART - MIN_PART + 1)); s3_storage::oracle::check_plan(total_size, shaped as usize); // The entry point the four real call sites actually use. s3_storage::oracle::check_auto(total_size); });