security(mpegts): avoid repeated audio buffer drains (#2898)

This commit is contained in:
Earl Co
2026-10-24 04:50:14 -04:00
committed by GitHub
parent 894a9b56b6
commit b9689dd3a3
+5 -2
View File
@@ -652,11 +652,14 @@ impl Splitter {
match next {
Some(d) => {
self.skipped += d as u64;
self.trim(self.buf.len() - (i + 1 + d));
// Keep a cursor into the current window rather than draining its
// prefix for every false sync candidate.
self.next_frame = Some(at + 1 + d as u64);
}
None => {
self.skipped += (self.buf.len() - i - 1) as u64;
self.trim(0);
// A split header can begin in the final few bytes; compact once.
self.trim(7);
return;
}
}