[FFmpeg-cvslog] avcodec/wmv2enc: allocate padding for extradata and check malloc failure

Michael Niedermayer git at videolan.org
Sun May 18 16:05:44 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun May 18 15:58:03 2014 +0200| [6e8fe448154e1aa0928cb0d2e1aecb7255c751cc] | committer: Michael Niedermayer

avcodec/wmv2enc: allocate padding for extradata and check malloc failure

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6e8fe448154e1aa0928cb0d2e1aecb7255c751cc
---

 libavcodec/wmv2enc.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/wmv2enc.c b/libavcodec/wmv2enc.c
index 6aeee59..869b3c7 100644
--- a/libavcodec/wmv2enc.c
+++ b/libavcodec/wmv2enc.c
@@ -60,7 +60,9 @@ static av_cold int wmv2_encode_init(AVCodecContext *avctx){
     ff_wmv2_common_init(w);
 
     avctx->extradata_size= 4;
-    avctx->extradata= av_mallocz(avctx->extradata_size + 10);
+    avctx->extradata= av_mallocz(avctx->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
+    if (!avctx->extradata)
+        return AVERROR(ENOMEM);
     encode_ext_header(w);
 
     return 0;



More information about the ffmpeg-cvslog mailing list