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

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1776>
This commit is contained in:
Sebastian Dröge 2024-09-17 11:59:36 +03:00
parent 1675e517b3
commit aae9d5c0e9

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