Skip to content

Commit 63ca8c6

Browse files
committed
Fix assertion failure in create_sample_table triggered by fuzzing.
Before 4499bc5, create_sample_table returned None if Track had no timescale present. After 4499bc5, it tries to create a dummy zero timescale instead. This dummy timescale always uses 0 for the track id, which is invalid for all other track ids and will eventually trigger an assert in [track_time_to_us](https://github.com/mozilla/mp4parse-rust/blob/da2cb93d3cebbac2644907633b51fc5366a0cf76/mp4parse_capi/src/lib.rs#L605). One solution is to create the dummy timescale using the current track's id instead, but given the current code has been shipping for several years without triggering this assert (outside of fuzzing), I don't believe we need to use a dummy timescale for valid files. Given that, it seems better to revert to the old behaviour of returning None from create_sample_table.
1 parent e35ec78 commit 63ca8c6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mp4parse_capi/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1277,7 +1277,7 @@ impl<'a> SampleToChunkIterator<'a> {
12771277
fn create_sample_table(track: &Track, track_offset_time: i64) -> Option<Vec<Mp4parseIndice>> {
12781278
let timescale = match track.timescale {
12791279
Some(ref t) => TrackTimeScale::<i64>(t.0 as i64, t.1),
1280-
_ => TrackTimeScale::<i64>(0, 0),
1280+
_ => return None,
12811281
};
12821282

12831283
let (stsc, stco, stsz, stts) = match (&track.stsc, &track.stco, &track.stsz, &track.stts) {

0 commit comments

Comments
 (0)