Skip to content

Commit 32775cc

Browse files
authored
Merge pull request #250 from mozilla/oss-fuzz-5139142796902400
Add check for required explicit extent offset and length in iloc
2 parents 6094234 + f91181e commit 32775cc

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

mp4parse/src/lib.rs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ struct SingleItemTypeReferenceBox {
853853

854854
/// Potential sizes (in bytes) of variable-sized fields of the 'iloc' box
855855
/// See ISOBMFF (ISO 14496-12:2015) § 8.11.3
856-
#[derive(Debug)]
856+
#[derive(Debug, Clone, Copy, PartialEq)]
857857
enum IlocFieldSize {
858858
Zero,
859859
Four,
@@ -1973,6 +1973,16 @@ fn read_iloc<T: Read>(src: &mut BMFFBox<T>) -> Result<TryVec<ItemLocationBoxItem
19731973
));
19741974
}
19751975

1976+
// "If only one extent is used (extent_count = 1) then either or both of the
1977+
// offset and length may be implied"
1978+
if extent_count != 1
1979+
&& (offset_size == IlocFieldSize::Zero || length_size == IlocFieldSize::Zero)
1980+
{
1981+
return Err(Error::InvalidData(
1982+
"extent_count != 1 requires explicit offset and length per ISOBMFF (ISO 14496-12:2015) § 8.11.3.3",
1983+
));
1984+
}
1985+
19761986
let mut extents = TryVec::with_capacity(extent_count.to_usize())?;
19771987

19781988
for _ in 0..extent_count {

0 commit comments

Comments
 (0)