[FFmpeg-cvslog] 4xm: allocate extradata properly.

Anton Khirnov git at videolan.org
Sun May 18 13:15:36 CEST 2014


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sat May  3 08:50:41 2014 +0200| [d256ed78ffe202a4dcc8d625becffc716bfa3977] | committer: Anton Khirnov

4xm: allocate extradata properly.

Pad it with the required amount of zeros, check for malloc failure.

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

 libavformat/4xm.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/4xm.c b/libavformat/4xm.c
index 7a87c36..6253ffb 100644
--- a/libavformat/4xm.c
+++ b/libavformat/4xm.c
@@ -110,8 +110,11 @@ static int parse_vtrk(AVFormatContext *s,
 
     st->codec->codec_type     = AVMEDIA_TYPE_VIDEO;
     st->codec->codec_id       = AV_CODEC_ID_4XM;
+
+    st->codec->extradata      = av_mallocz(4 + FF_INPUT_BUFFER_PADDING_SIZE);
+    if (!st->codec->extradata)
+        return AVERROR(ENOMEM);
     st->codec->extradata_size = 4;
-    st->codec->extradata      = av_malloc(4);
     AV_WL32(st->codec->extradata, AV_RL32(buf + 16));
     st->codec->width  = AV_RL32(buf + 36);
     st->codec->height = AV_RL32(buf + 40);



More information about the ffmpeg-cvslog mailing list