forge
Explore
Log in

Don't you dare go Hollow

lane-av1refusalspan: a closer seen before the body opens is not ours

Browse files at this commit

eec2f7d28305723a527c1cf881c2945ff0823da3Ahmet Kaan GümüşParent: 8a8b3cf
`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.rsmodified+8 -3
@@ -2336,9 +2336,14 @@ mod tests {
23362336 depth += 1;
23372337 }
23382338 b'}' => {
2339- depth -= 1;
2340- if depth == 0 {
2341- return open.map(|o| (o, i));
2339+ // A closer seen BEFORE the body opened is not ours (it can
2340+ // only come from a signature or a type ascription the scan
2341+ // mis-read); ignore it rather than underflowing `depth`.
2342+ if depth > 0 {
2343+ depth -= 1;
2344+ if depth == 0 {
2345+ return open.map(|o| (o, i));
2346+ }
23422347 }
23432348 }
23442349 _ => {}