]> git.sesse.net Git - ffmpeg/commitdiff
4xm: allocate extradata properly.
authorAnton Khirnov <anton@khirnov.net>
Sat, 3 May 2014 06:50:41 +0000 (08:50 +0200)
committerAnton Khirnov <anton@khirnov.net>
Sun, 18 May 2014 08:19:35 +0000 (10:19 +0200)
Pad it with the required amount of zeros, check for malloc failure.

libavformat/4xm.c

index 7a87c3695ae5dab58c4b653e7d7fa51c706a8d04..6253ffb58ee4159080a88233f73eb235a7d62fe5 100644 (file)
@@ -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);