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

Francois Cartegnie git at videolan.org
Wed Dec 13 20:26:18 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Dec 13 20:22:34 2017 +0100| [59535a015e94d3b70b30dce1c2aff8c23930b656] | committer: Francois Cartegnie

demux: mp4: check handler before dereferencing sample entry

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=59535a015e94d3b70b30dce1c2aff8c23930b656
---

 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 76de46b21d..4b03a1c6dd 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -2816,7 +2816,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 */
@@ -2831,7 +2832,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 )
         {
@@ -2854,7 +2856,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