[vlc-devel] [PATCH 2/2] demux/mp4: MP4_TrackGetDTS: prevent usage	of uninitialized data
    Filip Roséen 
    filip at atch.se
       
    Sun Nov  6 03:19:16 CET 2016
    
    
  
The previous implementation would suffer from undefined-behavior if
there is no chunk to use, as such it is better to simply abort (and
signal an error) if this is the case.
---
 modules/demux/mp4/mp4.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/modules/demux/mp4/mp4.c b/modules/demux/mp4/mp4.c
index 6e43c19..8b6457f 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -271,6 +271,9 @@ static inline int64_t MP4_TrackGetDTS( demux_t *p_demux, mp4_track_t *p_track )
 static inline bool MP4_TrackGetPTSDelta( demux_t *p_demux, mp4_track_t *p_track,
                                          int64_t *pi_delta )
 {
+    if( p_track->cchunk == NULL && p_track->i_chunk_count == 0 )
+        return false;
+
     VLC_UNUSED( p_demux );
     mp4_chunk_t *ck;
     ck = ( p_track->cchunk ) ? p_track->cchunk /* DemuxFrg */
-- 
2.10.2
    
    
More information about the vlc-devel
mailing list