From a5cbf1991c3d04b0be3c23ee0a7096b5a365cc85 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 22 Sep 2013 15:58:13 +0200 Subject: [PATCH] avformat/mov: reset extradata size when extradata gets deallocated due to realloc failure This prevents the fields from becoming inconsistent Signed-off-by: Michael Niedermayer --- libavformat/mov.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/libavformat/mov.c b/libavformat/mov.c index 4b7b4c3b6f..895af18576 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -993,8 +993,10 @@ static int mov_read_extradata(MOVContext *c, AVIOContext *pb, MOVAtom atom, size= (uint64_t)st->codec->extradata_size + atom.size + 8 + FF_INPUT_BUFFER_PADDING_SIZE; if (size > INT_MAX || (uint64_t)atom.size > INT_MAX) return AVERROR_INVALIDDATA; - if ((err = av_reallocp(&st->codec->extradata, size)) < 0) + if ((err = av_reallocp(&st->codec->extradata, size)) < 0) { + st->codec->extradata_size = 0; return err; + } buf = st->codec->extradata + st->codec->extradata_size; st->codec->extradata_size= size - FF_INPUT_BUFFER_PADDING_SIZE; AV_WB32( buf , atom.size + 8);