From: Hugo Beauzée-Luyssen Date: Fri, 8 Dec 2017 13:00:41 +0000 (+0100) Subject: libmp4: sidx: Return early if there are no items in the box X-Git-Url: https://git.videolan.org/gitweb.cgi/vlc.git/?p=vlc.git;p=vlc.git;a=commitdiff_plain;h=45aee180d61c01050f0fb916085e49b3051d5ac1 libmp4: sidx: Return early if there are no items in the box This also fixes a buffer overrun when MP4_VERBOSE is defined and i_count is 0 --- diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c index 769a7973df..60767f9eb0 100644 --- a/modules/demux/mp4/libmp4.c +++ b/modules/demux/mp4/libmp4.c @@ -1027,6 +1027,8 @@ static int MP4_ReadBox_sidx( stream_t *p_stream, MP4_Box_t *p_box ) VLC_UNUSED(i_reserved); MP4_GET2BYTES( i_reserved ); MP4_GET2BYTES( i_count ); + if( i_count == 0 ) + MP4_READBOX_EXIT( 1 ); p_sidx_data->i_reference_count = i_count; p_sidx_data->p_items = vlc_alloc( i_count, sizeof( MP4_Box_sidx_item_t ) );