Skip to content

Commit 7f33add

Browse files
authored
Merge pull request #233 from mozilla/ftyp-prealloc
When reading ftyp preallocate the memory to hold all the brands
2 parents 87d79a2 + 7811d9a commit 7f33add

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mp4parse/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1963,7 +1963,7 @@ fn read_ftyp<T: Read>(src: &mut BMFFBox<T>) -> Result<FileTypeBox> {
19631963
}
19641964
// Is a brand_count of zero valid?
19651965
let brand_count = bytes_left / 4;
1966-
let mut brands = TryVec::new();
1966+
let mut brands = TryVec::with_capacity(brand_count.try_into()?)?;
19671967
for _ in 0..brand_count {
19681968
brands.push(be_u32(src)?.into())?;
19691969
}

0 commit comments

Comments
 (0)