mirror of https://git.ffmpeg.org/ffmpeg.git
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: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 9e0f3352d1
)
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
This commit is contained in:
parent
590a168cf9
commit
a92b9ed7e3
|
@ -70,6 +70,7 @@ static int hnm_read_header(AVFormatContext *s)
|
|||
Hnm4DemuxContext *hnm = s->priv_data;
|
||||
AVIOContext *pb = s->pb;
|
||||
AVStream *vst;
|
||||
int ret;
|
||||
|
||||
/* default context members */
|
||||
hnm->pts = 0;
|
||||
|
@ -113,10 +114,10 @@ static int hnm_read_header(AVFormatContext *s)
|
|||
vst->codecpar->codec_tag = 0;
|
||||
vst->codecpar->width = hnm->width;
|
||||
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;
|
||||
memcpy(vst->codecpar->extradata, &hnm->version, 1);
|
||||
vst->codecpar->extradata[0] = hnm->version;
|
||||
|
||||
vst->start_time = 0;
|
||||
|
||||
|
|
Loading…
Reference in New Issue