Skip to content

Commit

Permalink
Fix crash when working with invalid file
Browse files Browse the repository at this point in the history
  • Loading branch information
dchengTSC committed Mar 18, 2021
1 parent 48f0c8c commit aa06c07
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/mp4file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3461,6 +3461,9 @@ const char *MP4File::GetTrackMediaDataName (MP4TrackId trackId)
MP4Atom *pAtom =
FindAtom(MakeTrackName(trackId,
"mdia.minf.stbl.stsd"));
if ( pAtom == nullptr )
return nullptr;

if (pAtom->GetNumberOfChildAtoms() != 1) {
log.errorf("%s: \"%s\": track %d has more than 1 child atoms in stsd",
__FUNCTION__, GetFilename().c_str(), trackId);
Expand Down

0 comments on commit aa06c07

Please sign in to comment.