From 6e8fe448154e1aa0928cb0d2e1aecb7255c751cc Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michaelni@gmx.at>
Date: Sun, 18 May 2014 15:58:03 +0200
Subject: [PATCH] avcodec/wmv2enc: allocate padding for extradata and check
 malloc failure

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
---
 libavcodec/wmv2enc.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavcodec/wmv2enc.c b/libavcodec/wmv2enc.c
index 6aeee59ab2a..869b3c7fe41 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;
-- 
GitLab