avformat/mov: reset extradata size when extradata gets deallocated due to realloc...
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 22 Sep 2013 13:58:13 +0000 (15:58 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 22 Sep 2013 14:11:02 +0000 (16:11 +0200)
This prevents the fields from becoming inconsistent

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/mov.c

index 4b7b4c3..895af18 100644 (file)
@@ -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);