Commit 9e0f3352 authored by Andreas Rheinhardt's avatar Andreas Rheinhardt Committed by Michael Niedermayer

avformat/hnm: Check for extradata allocation failure

and also add padding to it; moreover, don't use memcpy to write one byte
to extradata.
Signed-off-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: 's avatarPaul B Mahol <onemda@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 6bd8bcc2
...@@ -70,6 +70,7 @@ static int hnm_read_header(AVFormatContext *s) ...@@ -70,6 +70,7 @@ static int hnm_read_header(AVFormatContext *s)
Hnm4DemuxContext *hnm = s->priv_data; Hnm4DemuxContext *hnm = s->priv_data;
AVIOContext *pb = s->pb; AVIOContext *pb = s->pb;
AVStream *vst; AVStream *vst;
int ret;
/* default context members */ /* default context members */
hnm->pts = 0; hnm->pts = 0;
...@@ -113,10 +114,10 @@ static int hnm_read_header(AVFormatContext *s) ...@@ -113,10 +114,10 @@ static int hnm_read_header(AVFormatContext *s)
vst->codecpar->codec_tag = 0; vst->codecpar->codec_tag = 0;
vst->codecpar->width = hnm->width; vst->codecpar->width = hnm->width;
vst->codecpar->height = hnm->height; vst->codecpar->height = hnm->height;
vst->codecpar->extradata = av_mallocz(1); if ((ret = ff_alloc_extradata(vst->codecpar, 1)) < 0)
return ret;
vst->codecpar->extradata_size = 1; vst->codecpar->extradata[0] = hnm->version;
memcpy(vst->codecpar->extradata, &hnm->version, 1);
vst->start_time = 0; vst->start_time = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment