From eec2f7d28305723a527c1cf881c2945ff0823da3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Tue, 29 Sep 2026 07:27:42 +0300 Subject: [PATCH] lane-av1refusalspan: a closer seen before the body opens is not ours `depth -= 1` underflowed (debug panic, wrap in release) if the scan met a `}` between the `fn` keyword and the body's `{`. Ignore it instead. --- crates/ec-av1/src/refusal_inventory.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/ec-av1/src/refusal_inventory.rs b/crates/ec-av1/src/refusal_inventory.rs index 86f56b01..4662529b 100644 --- a/crates/ec-av1/src/refusal_inventory.rs +++ b/crates/ec-av1/src/refusal_inventory.rs @@ -2336,9 +2336,14 @@ mod tests { depth += 1; } b'}' => { - depth -= 1; - if depth == 0 { - return open.map(|o| (o, i)); + // A closer seen BEFORE the body opened is not ours (it can + // only come from a signature or a type ascription the scan + // mis-read); ignore it rather than underflowing `depth`. + if depth > 0 { + depth -= 1; + if depth == 0 { + return open.map(|o| (o, i)); + } } } _ => {}