Skip to content

Commit

Permalink
Fix a potential crash
Browse files Browse the repository at this point in the history
  • Loading branch information
KMojek committed Sep 13, 2024
1 parent f756267 commit d825f55
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/atoms.h
Original file line number Diff line number Diff line change
Expand Up @@ -491,9 +491,9 @@ class MP4SdtpAtom : public MP4FullAtom {
// number of bytes == stsz.sampleCount.
MP4BytesProperty& data;
private:
MP4SdtpAtom();
MP4SdtpAtom( const MP4SdtpAtom &src );
MP4SdtpAtom &operator= ( const MP4SdtpAtom &src );
MP4SdtpAtom() = delete;
MP4SdtpAtom( const MP4SdtpAtom& src ) = delete;
MP4SdtpAtom& operator=( const MP4SdtpAtom& src ) = delete;
};

class MP4SmiAtom : public MP4Atom {
Expand Down
16 changes: 9 additions & 7 deletions src/mp4track.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,13 +237,15 @@ MP4Track::MP4Track(MP4File& file, MP4Atom& trakAtom)
CalculateBytesPerSample();

// update sdtp log from sdtp atom
MP4SdtpAtom* sdtp = (MP4SdtpAtom*)m_trakAtom.FindAtom( "trak.mdia.minf.stbl.sdtp" );
if( sdtp ) {
uint8_t* buffer;
uint32_t bufsize;
sdtp->data.GetValue( &buffer, &bufsize );
m_sdtpLog.assign( (char*)buffer, bufsize );
free( buffer );
MP4Atom* atom = m_trakAtom.FindAtom( "trak.mdia.minf.stbl.sdtp" );
MP4SdtpAtom* sdtp = dynamic_cast<MP4SdtpAtom *>( atom );
if ( sdtp != nullptr )
{
uint8_t* buffer;
uint32_t bufsize;
sdtp->data.GetValue( &buffer, &bufsize );
m_sdtpLog.assign( (char*)buffer, bufsize );
free( buffer );
}
}

Expand Down

0 comments on commit d825f55

Please sign in to comment.