[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:12 CET 2017
    
    
  
vlc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Fri Dec  8 14:00:41 2017 +0100| [45aee180d61c01050f0fb916085e49b3051d5ac1] | 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
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=45aee180d61c01050f0fb916085e49b3051d5ac1
---
 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 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 ) );
    
    
More information about the vlc-commits
mailing list