[FFmpeg-cvslog] avformat/mov: check avio_read return in mov_read_dvc1()

Michael Niedermayer git at videolan.org
Wed Dec 25 15:03:12 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Dec 23 18:09:58 2013 +0100| [2a5fb0b13e218e6864825f8ff4ea7c6be21fb50b] | committer: Michael Niedermayer

avformat/mov: check avio_read return in mov_read_dvc1()

Fixes use of uninitialized memory
Fixes: msan_uninit-mem_7f46d5199ee1_9456_vc1-wmapro.ism
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 18bdd6a..9049a3c 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1133,6 +1133,7 @@ static int mov_read_dvc1(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     AVStream *st;
     uint8_t profile_level;
+    int ret;
 
     if (c->fc->nb_streams < 1)
         return 0;
@@ -1149,7 +1150,10 @@ static int mov_read_dvc1(MOVContext *c, AVIOContext *pb, MOVAtom atom)
     if (ff_alloc_extradata(st->codec, atom.size - 7))
         return AVERROR(ENOMEM);
     avio_seek(pb, 6, SEEK_CUR);
-    avio_read(pb, st->codec->extradata, st->codec->extradata_size);
+    ret = avio_read(pb, st->codec->extradata, st->codec->extradata_size);
+    if (ret != st->codec->extradata_size)
+        return ret < 0 ? ret : AVERROR_INVALIDDATA;
+
     return 0;
 }
 



More information about the ffmpeg-cvslog mailing list