forge
Explore
Log in

Don't you dare go Hollow

lane-av1unwritten r6: the guards were not where the offending values are decided

Browse files at this commit

6eedd604139a934278391e23175145e6ea727d33Ahmet Kaan GümüşParent: d561585
r5 claimed complete coverage and did not have it. The refutation (Agent03-5) showed
three of the eight refuse_invalid_subsize calls sat inside
PARTITION_HORZ_A..=PARTITION_VERT_B arms, so they could only observe partition
values 4..=7, while the arms that see the offending values had no guard above
them: kf 16-level decode_rect4_16 with part16=9 (VERT_4 -> BLOCK_4X16, 538 hits),
inter 64-level rect/1:4 with part64=2 (-> BLOCK_32X64, 887) and =9 (-> BLOCK_16X64,
280), inter w8 with part8=2 (-> BLOCK_4X8, 3476).

Fix: every guard now sits where the symbol is RESOLVED, before any dispatch arm
-- one per level per path. Corpus scan of the values each site now sees:
kf 64/32/16 and inter 64/32 all reach values 0..=9; kf 128 reaches 0..=3;
inter 8 reaches 0..=3. The only guard that fires over the corpus is kf 16-level
on PARTITION_VERT_B (BLOCK_8X16, INVALID at 4:2:2), 68 times. Every other corpus
stream is 4:2:0/4:4:4 where those values are legal, so "passed" is the correct
reading -- the sweep is what proves the legal siblings still decode.

Two committed, env-gated, off-by-default coverage scans, printed by decode_probe,
because prose about coverage is not evidence of coverage:
  EC_AV1_SUBSIZE_GUARD_TRACE  per guard call site, per partition value, reached
                              and fired -- a site that never sees an offending
                              value becomes visible instead of assumed covered
                              (exactly the defect r5 shipped);
  EC_AV1_SUBSIZE_ARM_TRACE    per unguarded dispatch arm, which values reach it
                              and whether their subsize is codable here.
2346 lines over the 127-fixture corpus.

Residue, stated: decode_rect4_16_intrabc is the declared exception and was NOT
audited (another lane's charter). The arm scan finds no dispatch reached with a
non-codable subsize that lacks a guard above it.

Two report defects corrected against my own measurement: the section-5 mutation
text named two chroma_plane_block_codable call sites that no longer exist, and
section 2.1's "differs by 1984 bytes" does not reproduce -- both dumps are 8192
bytes and the 0xAD counts are 33 and 65, which is the correct form. (A per-byte
diff is unstable because one sentinel sample propagates through the loop filters
into its neighbours.)

r6 regression: 127 fixtures, the witness only refuses, nothing newly refusing;
29 tests green.
crates/ec-av1/examples/decode_probe.rsmodified+5 -0
@@ -29,6 +29,11 @@ fn main() {
29 }29 }
30 };30 };
31 let report = || {31 let report = || {
32+ // lane-av1unwritten r6: the subsize-guard coverage table (per call
33+ // site, per partition value, reached vs fired). Env-gated
34+ // (`EC_AV1_SUBSIZE_GUARD_TRACE`), so it is empty unless asked for.
35+ ec_av1::decode::dump_subsize_guard_scan();
36+ ec_av1::decode::dump_subsize_arm_scan();
32 // The census below reads ec-av1's gate counters; without the crate's37 // The census below reads ec-av1's gate counters; without the crate's
33 // `gate-counters` feature every one of them is compiled out and reads 0.38 // `gate-counters` feature every one of them is compiled out and reads 0.
34 if !cfg!(feature = "gate-counters") {39 if !cfg!(feature = "gate-counters") {
crates/ec-av1/src/decode.rsmodified+160 -21
@@ -21485,11 +21485,32 @@ fn partition_subsize_dims(bsize: (usize, usize), part: usize) -> (usize, usize)
21485 /// selected, exactly as `decode_partition` does at `decodeframe.c:1449-1458`21485 /// selected, exactly as `decode_partition` does at `decodeframe.c:1449-1458`
21486 /// before descending into it. Returns libaom's named refusal for the caller to21486 /// before descending into it. Returns libaom's named refusal for the caller to
21487 /// propagate.21487 /// propagate.
21488+#[track_caller]
21488 fn refuse_invalid_subsize(21489 fn refuse_invalid_subsize(
21489 bsize: (usize, usize),21490 bsize: (usize, usize),
21490 part: usize,21491 part: usize,
21491 fctx: &crate::decode::FrameCtx,21492 fctx: &crate::decode::FrameCtx,
21492 ) -> Result<()> {21493 ) -> Result<()> {
21494+ // lane-av1unwritten r6: the coverage artefact. A guard that sits INSIDE a
21495+ // `PARTITION_HORZ_A..=PARTITION_VERT_B` arm can only ever observe 4..=7, so
21496+ // "the guard is present" is not evidence that an offending value is caught --
21497+ // which is exactly how r5's three misplaced guards read as coverage. This
21498+ // records, per CALL SITE and per partition value, how often the guard was
21499+ // reached and how often it fired, so a site that never sees an offending
21500+ // value is visible instead of assumed covered.
21501+ if crate::envflags::env_flag!("EC_AV1_SUBSIZE_GUARD_TRACE") {
21502+ note_subsize_guard(
21503+ std::panic::Location::caller(),
21504+ bsize,
21505+ part,
21506+ chroma_plane_block_codable(
21507+ partition_subsize_dims(bsize, part).0,
21508+ partition_subsize_dims(bsize, part).1,
21509+ ss_x(fctx),
21510+ ss_y(fctx),
21511+ ),
21512+ );
21513+ }
21493 let (bw, bh) = partition_subsize_dims(bsize, part);21514 let (bw, bh) = partition_subsize_dims(bsize, part);
21494 if chroma_plane_block_codable(bw, bh, ss_x(fctx), ss_y(fctx)) {21515 if chroma_plane_block_codable(bw, bh, ss_x(fctx), ss_y(fctx)) {
21495 Ok(())21516 Ok(())
@@ -21498,6 +21519,88 @@ fn refuse_invalid_subsize(
21498 }21519 }
21499 }21520 }
21500 21521
21522+/// lane-av1unwritten r6: the OTHER half of the coverage artefact. The guard
21523+/// table says what the guards see; this says what each DISPATCH ARM sees, so a
21524+/// dispatch reached with an offending partition value and no guard above it is a
21525+/// visible hole rather than an absence nobody noticed. `decode_probe` calls
21526+/// [`dump_subsize_arm_scan`] at exit under `EC_AV1_SUBSIZE_ARM_TRACE`.
21527+static SUBSIZE_ARM: std::sync::LazyLock<
21528+ std::sync::Mutex<std::collections::BTreeMap<(&'static str, usize), usize>>,
21529+> = std::sync::LazyLock::new(|| std::sync::Mutex::new(Default::default()));
21530+
21531+#[track_caller]
21532+pub(crate) fn note_subsize_arm(part: usize, codable: bool) {
21533+ if !crate::envflags::env_flag!("EC_AV1_SUBSIZE_ARM_TRACE") {
21534+ return;
21535+ }
21536+ let site = std::panic::Location::caller();
21537+ let key = (
21538+ format!("{}:{}", site.file(), site.line()).leak() as &'static str,
21539+ part * 2 + usize::from(codable),
21540+ );
21541+ if let Ok(mut m) = SUBSIZE_ARM.lock() {
21542+ *m.entry(key).or_insert(0) += 1;
21543+ }
21544+}
21545+
21546+/// Prints and clears the [`note_subsize_arm`] table.
21547+pub fn dump_subsize_arm_scan() {
21548+ let Ok(mut m) = SUBSIZE_ARM.lock() else {
21549+ return;
21550+ };
21551+ for ((site, k), n) in m.iter() {
21552+ eprintln!(
21553+ "SUBSIZE_ARM site={site} part={} codable={} reached={n}",
21554+ k / 2,
21555+ if k % 2 == 1 { "true" } else { "false" },
21556+ );
21557+ }
21558+ m.clear();
21559+}
21560+
21561+/// Per-site, per-value counters for [`refuse_invalid_subsize`], plus the dump
21562+/// that makes the reach/guard split readable. `EC_AV1_SUBSIZE_GUARD_TRACE`
21563+/// records; `dump_subsize_guard_scan` prints (and clears) the table.
21564+static SUBSIZE_GUARD: std::sync::LazyLock<
21565+ std::sync::Mutex<std::collections::BTreeMap<(&'static str, usize, usize, bool), usize>>,
21566+> = std::sync::LazyLock::new(|| std::sync::Mutex::new(Default::default()));
21567+
21568+fn note_subsize_guard(
21569+ site: &'static std::panic::Location<'static>,
21570+ bsize: (usize, usize),
21571+ part: usize,
21572+ codable: bool,
21573+) {
21574+ let key = (
21575+ format!("{}:{}", site.file(), site.line()).leak() as &'static str,
21576+ bsize.0 * 256 + bsize.1,
21577+ part,
21578+ codable,
21579+ );
21580+ if let Ok(mut m) = SUBSIZE_GUARD.lock() {
21581+ *m.entry(key).or_insert(0) += 1;
21582+ }
21583+}
21584+
21585+/// Prints and clears the [`refuse_invalid_subsize`] table: one line per
21586+/// (site, block, partition value) with the times reached and whether the guard
21587+/// fired. `decode_probe` calls this at exit.
21588+pub fn dump_subsize_guard_scan() {
21589+ let Ok(mut m) = SUBSIZE_GUARD.lock() else {
21590+ return;
21591+ };
21592+ for ((site, bsize, part, codable), n) in m.iter() {
21593+ eprintln!(
21594+ "SUBSIZE_GUARD site={site} bsize={}x{} part={part} codable={codable} \
21595+ reached={n}{}",
21596+ bsize / 256,
21597+ bsize % 256,
21598+ if *codable { "" } else { " FIRED" },
21599+ );
21600+ }
21601+ m.clear();
21602+}
21603+
21501 /// [`chroma_plane_block_codable`] as libaom's refusal: a returned error naming21604 /// [`chroma_plane_block_codable`] as libaom's refusal: a returned error naming
21502 /// the shape and the subsampling mode, never an `assert!` -- a partition symbol21605 /// the shape and the subsampling mode, never an `assert!` -- a partition symbol
21503 /// is stream data, so a hostile file can reach it.21606 /// is stream data, so a hostile file can reach it.
@@ -36359,6 +36462,14 @@ pub(crate) fn decode_key_frame_tile_with_cdfs(
36359 );36462 );
36360 }36463 }
36361 let part16 = dec.symbol(&mut cdfs.partition_w16[ctx16]);36464 let part16 = dec.symbol(&mut cdfs.partition_w16[ctx16]);
36465+ // lane-av1unwritten r6: the partition symbol is RESOLVED and about to be
36466+ // dispatched. `partition_subsize_dims` is libaom's `get_partition_subsize`
36467+ // (common_data.h:71-90) reduced to dimensions, so this is
36468+ // `decode_partition`'s pre-descend check (decodeframe.c:1451-1460) on EVERY
36469+ // arm -- VERT, VERT_A / VERT_B, HORZ_4 and VERT_4 -- and the HORZ siblings
36470+ // keep decoding because the helper is exact, not a heuristic. key-frame 16x16 level.
36471+ refuse_invalid_subsize((16, 16), part16, fctx)?;
36472+
36362 if crate::envflags::env_flag!("EC_TRACE") {36473 if crate::envflags::env_flag!("EC_TRACE") {
36363 eprintln!(36474 eprintln!(
36364 "EC_PART_VAL mi_row={} mi_col={} bsize=6 value={}",36475 "EC_PART_VAL mi_row={} mi_col={} bsize=6 value={}",
@@ -36511,14 +36622,6 @@ pub(crate) fn decode_key_frame_tile_with_cdfs(
36511 let br = (mi_row0 + 2, mi_col0 + 2);36622 let br = (mi_row0 + 2, mi_col0 + 2);
36512 let mut done: Vec<((usize, usize), usize)> =36623 let mut done: Vec<((usize, usize), usize)> =
36513 Vec::new();36624 Vec::new();
36514- // lane-av1unwritten r4: the
36515- // 16x16-level 1:4 split --
36516- // VERT_4 selects BLOCK_4X16,
36517- // INVALID at 4:2:2; HORZ_4
36518- // selects BLOCK_16X4, whose (1,0)
36519- // cell is BLOCK_8X4 (valid, the
36520- // shape r2 wrongly refused).
36521- refuse_invalid_subsize((16, 16), part16, fctx)?;
36522 match part16 {36625 match part16 {
36523 PARTITION_HORZ_A => {36626 PARTITION_HORZ_A => {
36524 let m_tl =36627 let m_tl =
@@ -36675,6 +36778,17 @@ pub(crate) fn decode_key_frame_tile_with_cdfs(
36675 if part16 == PARTITION_HORZ_436778 if part16 == PARTITION_HORZ_4
36676 || part16 == PARTITION_VERT_436779 || part16 == PARTITION_VERT_4
36677 {36780 {
36781+ // lane-av1unwritten r6: arm census --
36782+ // which partition values reach here.
36783+ note_subsize_arm(
36784+ part16,
36785+ chroma_plane_block_codable(
36786+ partition_subsize_dims((16, 16), part16).0,
36787+ partition_subsize_dims((16, 16), part16).1,
36788+ ss_x(fctx),
36789+ ss_y(fctx),
36790+ ),
36791+ );
36678 decode_rect4_16(36792 decode_rect4_16(
36679 &mut dec,36793 &mut dec,
36680 &mut cdfs,36794 &mut cdfs,
@@ -54020,6 +54134,14 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
54020 );54134 );
54021 }54135 }
54022 let p = dec.symbol(&mut cdfs.partition_w64[sb_ctx]);54136 let p = dec.symbol(&mut cdfs.partition_w64[sb_ctx]);
54137+ // lane-av1unwritten r6: the partition symbol is RESOLVED and about to be
54138+ // dispatched. `partition_subsize_dims` is libaom's `get_partition_subsize`
54139+ // (common_data.h:71-90) reduced to dimensions, so this is
54140+ // `decode_partition`'s pre-descend check (decodeframe.c:1451-1460) on EVERY
54141+ // arm -- VERT, VERT_A / VERT_B, HORZ_4 and VERT_4 -- and the HORZ siblings
54142+ // keep decoding because the helper is exact, not a heuristic. inter-frame 64x64 level; `p` is the symbol.
54143+ refuse_invalid_subsize((64, 64), p, fctx)?;
54144+
54023 if crate::envflags::env_flag!("EC_AV1_TRACE") {54145 if crate::envflags::env_flag!("EC_AV1_TRACE") {
54024 eprintln!(54146 eprintln!(
54025 "TRACE partition_w64 mi=({},{}) ctx={sb_ctx} value={p} pre_rng={pre_rng}",54147 "TRACE partition_w64 mi=({},{}) ctx={sb_ctx} value={p} pre_rng={pre_rng}",
@@ -54135,6 +54257,16 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
54135 part64,54257 part64,
54136 PARTITION_HORZ | PARTITION_VERT | PARTITION_HORZ_4 | PARTITION_VERT_454258 PARTITION_HORZ | PARTITION_VERT | PARTITION_HORZ_4 | PARTITION_VERT_4
54137 ) {54259 ) {
54260+ // lane-av1unwritten r6: arm census.
54261+ note_subsize_arm(
54262+ part64,
54263+ chroma_plane_block_codable(
54264+ partition_subsize_dims((64, 64), part64).0,
54265+ partition_subsize_dims((64, 64), part64).1,
54266+ ss_x(fctx),
54267+ ss_y(fctx),
54268+ ),
54269+ );
54138 // lane-inter4 r1: the superblock-level rect + 1:4 pairs as54270 // lane-inter4 r1: the superblock-level rect + 1:4 pairs as
54139 // inter blocks -- two 64x32 / 32x64 strips, or four 64x16 /54271 // inter blocks -- two 64x32 / 32x64 strips, or four 64x16 /
54140 // 16x64 ones. Each piece keeps `side = SB` for every54272 // 16x64 ones. Each piece keeps `side = SB` for every
@@ -54306,11 +54438,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
54306 )?54438 )?
54307 };54439 };
54308 }54440 }
54309- // lane-av1unwritten r4: VERT on a 64x64 block selects
54310- // BLOCK_32X64 -- INVALID at 4:2:2. HORZ on the same block
54311- // selects BLOCK_64X32, whose (1,0) cell is BLOCK_32X32
54312- // (valid) and MUST keep decoding.
54313- refuse_invalid_subsize((64, 64), part64, fctx)?;
54314 match part64 {54441 match part64 {
54315 PARTITION_HORZ_A => {54442 PARTITION_HORZ_A => {
54316 ab_square32!(tl);54443 ab_square32!(tl);
@@ -54798,14 +54925,6 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
54798 )54925 )
54799 };54926 };
54800 }54927 }
54801- // lane-av1unwritten r5: the partition symbol is RESOLVED (a full CDF read or
54802- // an edge `gather`) and about to be dispatched. `partition_subsize_dims` is
54803- // libaom's `get_partition_subsize` (common_data.h:71-90) reduced to
54804- // dimensions, so this is `decode_partition`'s pre-descend check
54805- // (decodeframe.c:1449-1458) applied to EVERY arm at once -- VERT,
54806- // VERT_A / VERT_B, HORZ_4 and VERT_4 included. The HORZ siblings keep
54807- // decoding because the helper is exact, not a heuristic. (inter-frame duplicate)
54808- refuse_invalid_subsize((16, 16), part16, fctx)?;
54809 match part16 {54928 match part16 {
54810 PARTITION_HORZ_A => {54929 PARTITION_HORZ_A => {
54811 inter_leaf8!(at16, tl);54930 inter_leaf8!(at16, tl);
@@ -55000,6 +55119,14 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
55000 }55119 }
55001 let ec_dbg_pre = dec.debug_state().0;55120 let ec_dbg_pre = dec.debug_state().0;
55002 let part8 = dec.symbol(&mut cdfs.partition_w8[leaf_ctx]);55121 let part8 = dec.symbol(&mut cdfs.partition_w8[leaf_ctx]);
55122+ // lane-av1unwritten r6: the partition symbol is RESOLVED and about to be
55123+ // dispatched. `partition_subsize_dims` is libaom's `get_partition_subsize`
55124+ // (common_data.h:71-90) reduced to dimensions, so this is
55125+ // `decode_partition`'s pre-descend check (decodeframe.c:1451-1460) on EVERY
55126+ // arm -- VERT, VERT_A / VERT_B, HORZ_4 and VERT_4 -- and the HORZ siblings
55127+ // keep decoding because the helper is exact, not a heuristic. inter-frame 8x8 level.
55128+ refuse_invalid_subsize((8, 8), part8, fctx)?;
55129+
55003 if std::env::var_os("EC_DBG_SUB8").is_some() {55130 if std::env::var_os("EC_DBG_SUB8").is_some() {
55004 let ec_dbg_post = dec.debug_state().0;55131 let ec_dbg_post = dec.debug_state().0;
55005 eprintln!(55132 eprintln!(
@@ -55037,6 +55164,18 @@ pub(crate) fn decode_inter_frame_tile_with_cdfs(
55037 )?;55164 )?;
55038 continue;55165 continue;
55039 }55166 }
55167+ // lane-av1unwritten r6: arm census -- an
55168+ // 8x8-level VERT selects BLOCK_4X8, which
55169+ // is INVALID at 4:2:2.
55170+ note_subsize_arm(
55171+ part8,
55172+ chroma_plane_block_codable(
55173+ partition_subsize_dims((8, 8), part8).0,
55174+ partition_subsize_dims((8, 8), part8).1,
55175+ ss_x(fctx),
55176+ ss_y(fctx),
55177+ ),
55178+ );
55040 if part8 == PARTITION_VERT || part8 == PARTITION_HORZ {55179 if part8 == PARTITION_VERT || part8 == PARTITION_HORZ {
55041 // lane-intersub8 r3/r4/r5: two55180 // lane-intersub8 r3/r4/r5: two
55042 // BLOCK_8X4 (HORZ) / BLOCK_4X8 (VERT)55181 // BLOCK_8X4 (HORZ) / BLOCK_4X8 (VERT)
lanes/av1unwritten.report.mdmodified+84 -5
@@ -124,8 +124,14 @@ ba2957e1709507b8336e53cd908b7dfe2a59dc2064b1f5eb4bea9b3149a4653d
124 ```124 ```
125 125
126 Two distinct output hashes from one file with uninitialised planes; and with126 Two distinct output hashes from one file with uninitialised planes; and with
127-`EC_AV1_PLANE_SENTINEL=1` five runs give ONE hash, which differs from the plain127+`EC_AV1_PLANE_SENTINEL=1` five runs give ONE hash, and that hash differs from the
128-one (1984 bytes). Reproduced independently on a fresh `8d6998d7` worktree with128+plain one -- both dumps are 8192 bytes, and the sentinel dump carries 65 bytes
129+equal to `0xAD` against a 33-byte baseline in the plain dump. (An earlier draft of
130+this line said "differs by 1984 bytes"; that byte count does not reproduce, and the
131+`0xAD` counts are the correct form. A per-byte diff of the two dumps is not
132+stable, because one sentinel sample propagates through the loop filters into its
133+neighbours -- which is itself the reason the dependence matters.) Reproduced
134+independently on a fresh `8d6998d7` worktree with
129 its own target dir (Main: `d35d59cce59cfa2b` / `5b38d5079a6578a8` plain,135 its own target dir (Main: `d35d59cce59cfa2b` / `5b38d5079a6578a8` plain,
130 `3a2ae6dbec390f26` sentinel x5).136 `3a2ae6dbec390f26` sentinel x5).
131 137
@@ -289,7 +295,7 @@ instrument is what would show it if one ever did.
289 * **Corpus, both trees.** Every fixture decoded with `EC_AV1_FINAL_DUMP`, every295 * **Corpus, both trees.** Every fixture decoded with `EC_AV1_FINAL_DUMP`, every
290 `.f*` hashed. Pre-fix vs post-fix the **126 valid fixtures are byte-identical**296 `.f*` hashed. Pre-fix vs post-fix the **126 valid fixtures are byte-identical**
291 and **none newly refuses**; the witness is the only difference and it now297 and **none newly refuses**; the witness is the only difference and it now
292- refuses. Re-run on the r5 predicate: `differing:298+ refuses. Re-run on the r6 predicate (guards relocated): `differing:
293 ['440_request_is_422']`, 126 fixtures emitting dumps, and exactly one fixture299 ['440_request_is_422']`, 126 fixtures emitting dumps, and exactly one fixture
294 whose output contains `REFUSED` — the witness. **The sweep cannot see the300 whose output contains `REFUSED` — the witness. **The sweep cannot see the
295 (16,4)-at-4:2:2 false positive**: no committed fixture carries a 16x8 block301 (16,4)-at-4:2:2 false positive**: no committed fixture carries a 16x8 block
@@ -352,8 +358,9 @@ under the sentinel); it is reported, not gated, because the gate's job is the
352 contract and the contract is the refusal. The determinism is then a consequence358 contract and the contract is the refusal. The determinism is then a consequence
353 of the refusal, not a second assertion.359 of the refusal, not a second assertion.
354 360
355-**Mutation.** Deleting the two `chroma_plane_block_codable` call sites puts the361+**Mutation.** Deleting any one `refuse_invalid_subsize` call the witness passes
356-witness back to `OK: 1 frames decoded` and the gate's `unwrap_or_else` panics362+through (the 128 root's, the key 64's, ...) puts the witness back to
363+`OK: 1 frames decoded` and the gate's `unwrap_or_else` panics
357 with "the pin must be REFUSED, not decoded"; replacing the message text so it no364 with "the pin must be REFUSED, not decoded"; replacing the message text so it no
358 longer contains libaom's wording reds the second assertion; pointing the positive365 longer contains libaom's wording reds the second assertion; pointing the positive
359 control at the witness reds the third.366 control at the witness reds the third.
@@ -387,3 +394,75 @@ control at the witness reds the third.
387 what `cargo build` last reported. A probe built from this worktree was read as394 what `cargo build` last reported. A probe built from this worktree was read as
388 a measurement of `main` here and inverted a whole section of the report until395 a measurement of `main` here and inverted a whole section of the report until
389 `strings` was checked.396 `strings` was checked.
397+
398+---
399+
400+## 8. r6 — the guards were not where the values are decided
401+
402+**r5 claimed complete coverage and did not have it.** The refutation pass
403+(Agent03-5) showed that three of the eight `refuse_invalid_subsize` calls sat
404+**inside `PARTITION_HORZ_A..=PARTITION_VERT_B` arms**, so they could only ever
405+observe partition values 4..=7 — and the arms that DO see the offending values
406+had no guard above them:
407+
408+| unguarded arm | value | subsize | corpus hits |
409+|---|---|---|---|
410+| kf 16-level `decode_rect4_16` | `part16 = 9` (VERT_4) | `BLOCK_4X16` | 538 |
411+| inter 64-level rect / 1:4 arm | `part64 = 2` (VERT) | `BLOCK_32X64` | 887 |
412+| inter 64-level rect / 1:4 arm | `part64 = 9` (VERT_4) | `BLOCK_16X64` | 280 |
413+| inter `w8` arm | `part8 = 2` (VERT) | `BLOCK_4X8` | 3476 |
414+
415+All four are `BLOCK_INVALID` at `av1_ss_size_lookup[..][1][0]` — exactly what
416+libaom refuses at `decodeframe.c:1451-1460`.
417+
418+### 8.1 The fix
419+
420+Every guard now sits where the partition symbol is **RESOLVED**, before any
421+dispatch arm — one guard per level per path, so it can see every value that level
422+produces:
423+
424+| site | level | values seen (corpus scan) |
425+|---|---|---|
426+| `decode.rs:35584` kf 128 root | 128x128 | 0,1,2,3 |
427+| `decode.rs:36274` kf 64 | 64x64 | 0,1,2,3,4,5,6,7,8,9 |
428+| `decode.rs:36402` kf 32 | 32x32 | 0,1,2,3,4,5,6,7,8,9 |
429+| `decode.rs:36468` kf 16 | 16x16 | 0,1,2,3,4,5,6,7,8,9 — **part=7 FIRED 68x** |
430+| `decode.rs:54140` inter 64 | 64x64 | 0,1,2,3,4,5,7,8,9 |
431+| `decode.rs:54576` inter 32 | 32x32 | 0,1,2,3,4,5,6,7,8,9 |
432+| `decode.rs:55125` inter 8 | 8x8 | 0,1,2,3 |
433+
434+The only guard that fires over the corpus is the key-frame 16-level one, on
435+`PARTITION_VERT_B` (subsize `BLOCK_8X16`, INVALID at 4:2:2) — 68 times, in
436+`reelb_*`-class streams. Every other corpus stream is 4:2:0 / 4:4:4, where the same
437+values are legal, so "passed" is the correct reading and **the sweep is what
438+proves the legal siblings still decode**.
439+
440+### 8.2 The coverage artefact (this is what made the failure visible)
441+
442+Two env-gated scans, both printed by `decode_probe` and both committed, because
443+prose about coverage is not evidence of coverage:
444+
445+* `EC_AV1_SUBSIZE_GUARD_TRACE=1` — per **guard call site**, per partition value:
446+ times reached and whether the guard fired. A site that never sees an offending
447+ value is then visible instead of assumed covered. That is exactly the defect
448+ r5 shipped: three sites whose reachable value set was 4..=7 only.
449+* `EC_AV1_SUBSIZE_ARM_TRACE=1` — per **unguarded dispatch arm**, which partition
450+ values actually reach it and whether their subsize is codable at this frame's
451+ subsampling.
452+
453+Both are off by default and cost nothing when unset.
454+
455+```
456+$ for f in crates/ec-av1/fixtures/*.obu; do EC_AV1_SUBSIZE_GUARD_TRACE=1 EC_AV1_SUBSIZE_ARM_TRACE=1 ./target/debug/examples/decode_probe "$f" 2>&1 >/dev/null | grep -E '^SUBSIZE_(GUARD|ARM)'; done > /tmp/gt.txt
457+$ wc -l /tmp/gt.txt
458+2346 /tmp/gt.txt
459+```
460+
461+### 8.3 Residue
462+
463+* **`decode_rect4_16_intrabc` is the declared exception and was NOT audited.** It
464+ is another lane's charter. Everything above covers the intra and inter paths
465+ this lane owns.
466+* No other subsize-selecting dispatch lacks a guard above it: the arm scan finds
467+ no dispatch reached with a non-codable subsize and no `refuse_invalid_subsize`
468+ call between it and the symbol's resolution.