Skip to content

Commit c30d530

Browse files
rilliankinetiknz
authored andcommitted
Check opus header size for overflow.
We cast a size to a u32 for the capi data return. Our serialization routine will never produce a large header, but be defensive and make sure we're not writing the wrong size when we cast down, as we do with the other, less-controlled headers.
1 parent 4e8b543 commit c30d530

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

mp4parse_capi/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,6 +469,9 @@ pub unsafe extern fn mp4parse_get_track_audio_info(parser: *mut mp4parse_parser,
469469
match header.get(&track_index) {
470470
None => {}
471471
Some(v) => {
472+
if v.len() > std::u32::MAX as usize {
473+
return MP4PARSE_ERROR_INVALID;
474+
}
472475
(*info).codec_specific_config.length = v.len() as u32;
473476
(*info).codec_specific_config.data = v.as_ptr();
474477
}

0 commit comments

Comments
 (0)