[FFmpeg-cvslog] avformat/mov: reset extradata size when extradata gets deallocated due to realloc failure

Michael Niedermayer git at videolan.org
Sun Sep 22 16:19:04 CEST 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Sep 22 15:58:13 2013 +0200| [a5cbf1991c3d04b0be3c23ee0a7096b5a365cc85] | committer: Michael Niedermayer

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 <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a5cbf1991c3d04b0be3c23ee0a7096b5a365cc85
---

 libavformat/mov.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 4b7b4c3..895af18 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);



More information about the ffmpeg-cvslog mailing list