Skip to content

Commit 46df766

Browse files
committed
[crash] Handle subtitle packets with no data
1 parent 5d3364b commit 46df766

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

vobsub/src/sub.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,9 @@ fn subtitle(raw_data: &[u8], base_time: f64) -> Result<Subtitle> {
303303
// explicit offsets into `packet` in several places.
304304

305305
// Figure out where our control data starts.
306+
if raw_data.len() < 2 {
307+
return Err("unexpected end of subtitle data".into());
308+
}
306309
let (_, initial_control_offset) = parse_be_u16_as_usize(&raw_data[2..])?;
307310

308311
// Declare data we want to collect from our control packets.

0 commit comments

Comments
 (0)