[vlc-commits] libmp4: sidx: Return early if there are no items in the box

Hugo Beauzée-Luyssen git at videolan.org
Fri Dec 8 14:01:47 CET 2017


vlc/vlc-3.0 | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Dec  8 14:00:41 2017 +0100| [b10a3596f3cb9ad826c33c661091b1175adf529f] | committer: Hugo Beauzée-Luyssen

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

(cherry picked from commit 45aee180d61c01050f0fb916085e49b3051d5ac1)
Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

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

 modules/demux/mp4/libmp4.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 118d2f10f4..5122548040 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -995,6 +995,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 ) );



More information about the vlc-commits mailing list