[vlc-commits] demux: mp4: don't read at all if not content

Francois Cartegnie git at videolan.org
Sun Sep 28 07:18:46 CEST 2014


vlc/vlc-2.2 | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Sep 24 13:32:37 2014 +0200| [a92109bb6e9fd5da974a78d74978ca67070139e7] | committer: Jean-Baptiste Kempf

demux: mp4: don't read at all if not content

fixes 1 byte read overflow

(cherry picked from commit 2d07e7885945ef30a55a078d956e4b6714c5c1ee)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

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

diff --git a/modules/demux/mp4/libmp4.c b/modules/demux/mp4/libmp4.c
index e5e9697..1d02274 100644
--- a/modules/demux/mp4/libmp4.c
+++ b/modules/demux/mp4/libmp4.c
@@ -1396,7 +1396,7 @@ static int MP4_ReadBox_avcC( stream_t *p_stream, MP4_Box_t *p_box )
         if( !p_avcC->i_sps_length || !p_avcC->sps )
             goto error;
 
-        for( i = 0; i < p_avcC->i_sps && i_read; i++ )
+        for( i = 0; i < p_avcC->i_sps && i_read > 2; i++ )
         {
             MP4_GET2BYTES( p_avcC->i_sps_length[i] );
             if ( p_avcC->i_sps_length[i] > i_read )
@@ -1421,7 +1421,7 @@ static int MP4_ReadBox_avcC( stream_t *p_stream, MP4_Box_t *p_box )
         if( !p_avcC->i_pps_length || !p_avcC->pps )
             goto error;
 
-        for( i = 0; i < p_avcC->i_pps && i_read; i++ )
+        for( i = 0; i < p_avcC->i_pps && i_read > 2; i++ )
         {
             MP4_GET2BYTES( p_avcC->i_pps_length[i] );
             if( p_avcC->i_pps_length[i] > i_read )



More information about the vlc-commits mailing list