1
0
Fork 0
mirror of https://github.com/alfg/mp4-rust.git synced 2024-12-22 12:06:33 +00:00

bugfix: break reader loop if BoxHeader is size zero to prevent dead-loop. (#65)

This commit is contained in:
Alfred Gutierrez 2021-12-23 18:49:01 -08:00 committed by GitHub
parent 7be2ebe49d
commit e7f5f71ae3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -32,6 +32,11 @@ impl<R: Read + Seek> Mp4Reader<R> {
let header = BoxHeader::read(&mut reader)?; let header = BoxHeader::read(&mut reader)?;
let BoxHeader { name, size: s } = header; let BoxHeader { name, size: s } = header;
// Break if size zero BoxHeader, which can result in dead-loop.
if s == 0 {
break;
}
// Match and parse the atom boxes. // Match and parse the atom boxes.
match name { match name {
BoxType::FtypBox => { BoxType::FtypBox => {