[vlc-commits] demux: mp4: check handler before dereferencing sample entry

Francois Cartegnie git at videolan.org
Wed Dec 13 20:29:46 CET 2017


vlc/vlc-3.0 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Dec 13 20:22:34 2017 +0100| [81316cc3a9bdfa42e860d7d0ffad1adc00a88b15] | committer: Francois Cartegnie

demux: mp4: check handler before dereferencing sample entry

(cherry picked from commit 59535a015e94d3b70b30dce1c2aff8c23930b656)

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=81316cc3a9bdfa42e860d7d0ffad1adc00a88b15
---

 modules/demux/mp4/mp4.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 87a6dde2c1..9fb204b212 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -2814,7 +2814,8 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
     switch( p_track->fmt.i_cat )
     {
     case VIDEO_ES:
-        if ( !SetupVideoES( p_demux, p_track, p_sample ) )
+        if ( p_sample->i_handler != ATOM_vide ||
+             !SetupVideoES( p_demux, p_track, p_sample ) )
             return VLC_EGENERIC;
 
         /* Set frame rate */
@@ -2829,7 +2830,8 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
         break;
 
     case AUDIO_ES:
-        if ( !SetupAudioES( p_demux, p_track, p_sample ) )
+        if ( p_sample->i_handler != ATOM_soun ||
+             !SetupAudioES( p_demux, p_track, p_sample ) )
             return VLC_EGENERIC;
         if( p_sys->p_meta )
         {
@@ -2852,7 +2854,8 @@ static int TrackCreateES( demux_t *p_demux, mp4_track_t *p_track,
         break;
 
     case SPU_ES:
-        if ( !SetupSpuES( p_demux, p_track, p_sample ) )
+        if ( p_sample->i_handler != ATOM_text ||
+             !SetupSpuES( p_demux, p_track, p_sample ) )
            return VLC_EGENERIC;
         break;
 



More information about the vlc-commits mailing list