[FFmpeg-cvslog] avformat/mov: Check avio_read() return code in mov_read_extradata() and shrink the extradata if needed / return an error
Michael Niedermayer
git at videolan.org
Sun Dec 15 00:45:00 CET 2013
ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sat Dec 14 23:59:39 2013 +0100| [7a5d3a41fe380422cca80279732f297a2e118212] | committer: Michael Niedermayer
avformat/mov: Check avio_read() return code in mov_read_extradata() and shrink the extradata if needed / return an error
Fixes use of uninitialized data
Fixes: msan_uninit-mem_7ff57193e77e_2715_RAW512K_Stream_004.mov
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=7a5d3a41fe380422cca80279732f297a2e118212
---
libavformat/mov.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 0157a7d..7ca4f92 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1002,7 +1002,13 @@ static int mov_read_extradata(MOVContext *c, AVIOContext *pb, MOVAtom atom,
st->codec->extradata_size= size - FF_INPUT_BUFFER_PADDING_SIZE;
AV_WB32( buf , atom.size + 8);
AV_WL32( buf + 4, atom.type);
- avio_read(pb, buf + 8, atom.size);
+ err = avio_read(pb, buf + 8, atom.size);
+ if (err < 0) {
+ return err;
+ } else if (err < atom.size) {
+ av_log(c->fc, AV_LOG_WARNING, "truncated extradata\n");
+ st->codec->extradata_size -= atom.size - err;
+ }
return 0;
}
More information about the ffmpeg-cvslog
mailing list