Skip to content

Commit

Permalink
fix integer overflow when ctts contains entries with negative offsets
Browse files Browse the repository at this point in the history
  • Loading branch information
Wumpf committed Nov 12, 2024
1 parent 0265f41 commit 5b2cae2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/reader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,9 @@ impl Mp4 {
ctts.entries[ctts_run_index as usize].sample_count as i64;
}

decode_timestamp + ctts.entries[ctts_run_index as usize].sample_offset as u64
decode_timestamp.saturating_add_signed(
ctts.entries[ctts_run_index as usize].sample_offset as i64,
)
} else {
decode_timestamp
};
Expand Down

0 comments on commit 5b2cae2

Please sign in to comment.