closedcaption: cea608utils: Avoid overflow when deciding which lines to retain

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1778>
This commit is contained in:
Sebastian Dröge 2024-09-17 11:59:36 +03:00 committed by Backport Bot
parent 18771be680
commit b532fdbca0

View file

@ -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;
}