]> git.sesse.net Git - vlc/commitdiff
ffmpeg: fix potential overread for mpeg4 with vol.
authorLaurent Aimar <fenrir@videolan.org>
Sat, 26 Jul 2003 15:34:43 +0000 (15:34 +0000)
committerLaurent Aimar <fenrir@videolan.org>
Sat, 26 Jul 2003 15:34:43 +0000 (15:34 +0000)
modules/codec/ffmpeg/video.c

index e0bfe328330d2a0ce4a391fb18e441757a43a485..fe85154a828a779f5df6e8dcd544f43faf5dbc05 100644 (file)
@@ -2,7 +2,7 @@
  * video.c: video decoder using ffmpeg library
  *****************************************************************************
  * Copyright (C) 1999-2001 VideoLAN
- * $Id: video.c,v 1.35 2003/07/10 01:33:41 fenrir Exp $
+ * $Id: video.c,v 1.36 2003/07/26 15:34:43 fenrir Exp $
  *
  * Authors: Laurent Aimar <fenrir@via.ecp.fr>
  *          Gildas Bazin <gbazin@netcourrier.com>
@@ -339,10 +339,16 @@ int E_( InitThread_Video )( vdec_thread_t *p_vdec )
 
         if( p_vdec->i_codec_id == CODEC_ID_MPEG4 )
         {
+            uint8_t *p_vol = malloc( i_size + FF_INPUT_BUFFER_PADDING_SIZE );
+
+            memcpy( p_vol, &p_vdec->p_format[1], i_size );
+            memset( &p_vol[i_size], 0, FF_INPUT_BUFFER_PADDING_SIZE );
+
             avcodec_decode_video( p_vdec->p_context, p_vdec->p_ff_pic,
                                   &b_gotpicture,
-                                  (void *)&p_vdec->p_format[1],
+                                  p_vol,
                                   i_size );
+            free( p_vol );
         }
 #if LIBAVCODEC_BUILD >= 4666
         else if( p_vdec->i_codec_id == CODEC_ID_SVQ3 )