P2: later
An appendix to the milestone.
P2: after the move
-
Callers cannot display or box
Error. Finding:ErrorderivesDebug,Clone,Copy,PartialEq,Eqand nothing else. An outside caller cannot?it intoBox<dyn core::error::Error>or print it to a person without matching every variant. Evidence:src/lib.rslines 178 to 191. Change:impl core::fmt::Displaywith one sentence per variant and the offset forBadField, andimpl core::error::Error(stable incoresince 1.81, inside the crate's rust-version if item 1 sets it there or later). Additive. Door: two-way. Effort: XS. -
Zonesis missing the std pair ofis_empty, and the two views disagree on lifetimes. Finding:Zoneshasiter,is_emptyandhas_rootand nolen;Verbshaslenandis_empty. The shapes rule asks for std's spelling and meaning, where the two come as a pair, and a reader who finds one expects the other.Zones::iterreturnsimpl Iterator<Item = &'a [u8]> + use<'a>(the items outlive the view), andVerbs::iterreturns+ '_(the iterator borrows the view), so a caller who collects one cannot write the other the same way. Neither implementsIntoIterator. Evidence:src/lib.rslines 791 to 818 and 1239 to 1285. Change:Zones::len(a count of the length-prefixed records; O(n) and documented so), the sameuse<'a>form onVerbs::iter, andIntoIterator for &Zonesand&Verbs. Door: two-way (additive). Effort: XS. -
The proofs cover version 1 and the first byte of version 2. Finding:
decode_never_panicsruns toDESCRIPTOR_LEN + 1bytes, which is the zone count byte and nothing after;a_decoded_manifest_encodes_back_to_its_bytesis version 1 only. The zone walk (check_zones,check_serviced,zones,service,zones_bytes),decode_verbs,decode_subtree_grantsand the encoding direction (item 3) have no harness. The fuzz target's documentation says so, candidly; the README should too. Evidence:src/verification.rslines 20 to 36;fuzz/fuzz_targets/capability_manifest_note_decode.rslines 11 to 16. Change: three bounded harnesses, each with its falsification patch.decodeis total atDESCRIPTOR_LEN + 1 + 1 + 3 + 1bytes (a version 3 descriptor with one three-byte zone, which exercises both walks, the service byte and the exact-length check).decode_verbsis total atverbs_len(2)bytes andgrants_forfinds each decoded word.decode_subtree_grantsis total at 9 bytes. The unwind bounds are small because the lengths are. Add the encoding harness of item 3.memchrunderpositiondominates Kani's time on the existing harness; a plainwhileloop inzerowould cut it, with no change in meaning. Door: two-way. Effort: M. -
The code writes the note header four times and pins the owner's length by hand. Finding:
Note::of,ZonedNote::of,ServicedNote::ofandSubtreeGrantsNote::ofeach writenamesz,descsz, the type and[OWNER[0], OWNER[1], OWNER[2], OWNER[3]]. The compile-time guard isOWNER.len() < NAME_FIELD, so an owner of five bytes would build with its last byte dropped andnameszsaying 6. Evidence:src/lib.rslines 577 to 597, 839 to 860, 953 to 974, 1087 to 1105, 978. Change: oneconst fn header(out: &mut [u8], descriptor_bytes: usize, kind: u32)that writes the three words and copiesOWNERin a loop, and a guardOWNER.len() + 1 <= NAME_FIELDthat is the real condition. The mutation triage's six equivalent+/-mutants in these loops become one. Door: two-way. Effort: XS. -
The dev-dependency on
interfaces_notebuys one equality. Finding:interfaces_noterepeatsOWNERso that it can depend on nothing, and this crate's testthe_interfaces_note_shares_the_manifest_notes_headerholds the two equal. After both move, that is a cross-repository dev-dependency pinned byrevfor one assertion. Evidence:Cargo.tomllines 18 to 20;src/tests.rslines 579 to 601. Change: keep it (the dependency is the organization's own and the test is the only thing that would notice drift), but cite it with aversion, and say in the README that the two crates share one note header. Dropping it is also fine once the README states the header bytes, since the ELF format fixes them. Door: two-way. Effort: XS. -
The
Program-sized tests and thefuzz_seedwriter usestdfrom inside ano_stdcrate. Finding:extern crate stdappears inside three test functions and theverb_testsmodule rather than once at the test root;tests/fuzz_seed.rsusesstdfreely, which is fine for an integration test. The pattern works and is only untidy. Evidence:src/tests.rslines 276, 333;src/lib.rsline 1340. Change: oneextern crate std;under#[cfg(test)]at the crate root. Door: two-way. Effort: XS.