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+5 -0
@@ -2336,11 +2336,16 @@ mod tests {
2336 depth += 1;2336 depth += 1;
2337 }2337 }
2338 b'}' => {2338 b'}' => {
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 {
2339 depth -= 1;2343 depth -= 1;
2340 if depth == 0 {2344 if depth == 0 {
2341 return open.map(|o| (o, i));2345 return open.map(|o| (o, i));
2342 }2346 }
2343 }2347 }
2348+ }
2344 _ => {}2349 _ => {}
2345 }2350 }
2346 i += 1;2351 i += 1;