Skip to content

Commit ae772de

Browse files
baumanjkinetiknz
authored andcommitted
Return error for overflow in create_sample_table
This is a fairly minimal fix to unblock fuzz testing. I'll follow up with a more general fix by wrapping these types and only allowing checked arithmetic. See https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=24883
1 parent 3ba7455 commit ae772de

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

mp4parse_capi/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,8 +1439,8 @@ fn create_sample_table(track: &Track, track_offset_time: i64) -> Option<TryVec<M
14391439

14401440
match (start_composition, end_composition, start_decode) {
14411441
(Some(s_c), Some(e_c), Some(s_d)) => {
1442-
sample.start_composition = s_c + track_offset_time;
1443-
sample.end_composition = e_c + track_offset_time;
1442+
sample.start_composition = s_c.checked_add(track_offset_time)?;
1443+
sample.end_composition = e_c.checked_add(track_offset_time)?;
14441444
sample.start_decode = s_d;
14451445
}
14461446
_ => return None,

0 commit comments

Comments
 (0)