[vlc-devel] [PATCH 1/2] demux/mp4: fix 17589: prevent usage of uninitialized data

Filip Roséen filip at atch.se
Sun Nov 6 03:19:15 CET 2016


The previous implementation would crash if MP4_TrackGetDTS was invoked
on a track that was neither fragmented, nor had any associated chunks.

The introduced if-statement will short-circuit the implementation, and
return VLC_TS_INVALID, prior to any potential usage of missing data.

fixes #17589
---
 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 e8c045e..6e43c19 100644
--- a/modules/demux/mp4/mp4.c
+++ b/modules/demux/mp4/mp4.c
@@ -219,6 +219,9 @@ static inline int64_t MP4_TrackGetDTS( demux_t *p_demux, mp4_track_t *p_track )
     demux_sys_t *p_sys = p_demux->p_sys;
     const mp4_chunk_t *p_chunk;
 
+    if( p_track->cchunk == NULL && p_track->i_chunk_count == 0 )
+        return VLC_TS_INVALID;
+
     p_chunk = ( p_track->cchunk ) ? p_track->cchunk /* DemuxFrg */
                                   : &p_track->chunk[p_track->i_chunk];
 
-- 
2.10.2



More information about the vlc-devel mailing list