From aae9d5c0e9a1981e4a2ce558eb5dada305d01a9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Tue, 17 Sep 2024 11:59:36 +0300 Subject: [PATCH] closedcaption: cea608utils: Avoid overflow when deciding which lines to retain Part-of: --- video/closedcaption/src/cea608utils.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/video/closedcaption/src/cea608utils.rs b/video/closedcaption/src/cea608utils.rs index 9e714f4d..e8f3ad6f 100644 --- a/video/closedcaption/src/cea608utils.rs +++ b/video/closedcaption/src/cea608utils.rs @@ -373,7 +373,7 @@ impl Cea608Frame { } let n_rows = self.mode.unwrap().rollup_rows().unwrap(); self.display_lines - .retain(|line| line.no > (self.base_row - n_rows + 1) as usize); + .retain(|line| line.no > self.base_row as usize + 1 - n_rows as usize); for line in self.display_lines.iter_mut() { line.no -= 1; }