diff options
author | Michael Niedermayer <michael@niedermayer.cc> | 2016-07-21 21:43:59 +0200 |
---|---|---|
committer | Michael Niedermayer <michael@niedermayer.cc> | 2016-07-21 21:55:18 +0200 |
commit | 38cc5c298c988950d2bfa0d16408f07ee7be7f3c (patch) | |
tree | ab5cef95ca917a5d09975e3af533c552566d33b1 /libavformat | |
parent | 9264bb7e79a50678eca6f320e1e1fb85bf00b009 (diff) | |
download | ffmpeg-38cc5c298c988950d2bfa0d16408f07ee7be7f3c.tar.gz |
avformat/mov: Do not allocate empty extradata
Fixes Ticket5723
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/mov.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c index 3843cebe67..7c8f784d71 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -2345,12 +2345,14 @@ static int mov_read_stsd(MOVContext *c, AVIOContext *pb, MOVAtom atom) return ret; /* Restore back the primary extradata. */ - av_free(st->codecpar->extradata); + av_freep(&st->codecpar->extradata); st->codecpar->extradata_size = sc->extradata_size[0]; - st->codecpar->extradata = av_mallocz(sc->extradata_size[0] + AV_INPUT_BUFFER_PADDING_SIZE); - if (!st->codecpar->extradata) - return AVERROR(ENOMEM); - memcpy(st->codecpar->extradata, sc->extradata[0], sc->extradata_size[0]); + if (sc->extradata_size[0]) { + st->codecpar->extradata = av_mallocz(sc->extradata_size[0] + AV_INPUT_BUFFER_PADDING_SIZE); + if (!st->codecpar->extradata) + return AVERROR(ENOMEM); + memcpy(st->codecpar->extradata, sc->extradata[0], sc->extradata_size[0]); + } return 0; } |