[vlc-commits] demux: mp4: use headersize for meta atom

Francois Cartegnie git at videolan.org
Mon Sep 5 09:31:14 CEST 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sun Sep  4 19:26:02 2016 +0200| [345d3502bf2dc6d01e68ac4a9e75b151b01c5fe9] | committer: Francois Cartegnie

demux: mp4: use headersize for meta atom

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

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

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index 5fcf256..807680e 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -3560,10 +3560,14 @@ static int MP4_ReadBox_meta( stream_t *p_stream, MP4_Box_t *p_box )
 {
     uint8_t meta_data[8];
     int i_actually_read;
+    const size_t i_headersize = mp4_box_headersize( p_box );
+
+    if( p_box->i_size < 8 || p_box->i_size - i_headersize < 4 )
+        return 0;
 
     // skip over box header
-    i_actually_read = vlc_stream_Read( p_stream, meta_data, 8 );
-    if( i_actually_read < 8 )
+    i_actually_read = vlc_stream_Read( p_stream, meta_data, i_headersize );
+    if( i_actually_read < i_headersize )
         return 0;
 
     if ( p_box->p_father && p_box->p_father->i_type == ATOM_udta ) /* itunes udta/meta */



More information about the vlc-commits mailing list