[FFmpeg-cvslog] avformat/mov: Fix signed integer overflows with total_size

Vitaly Buka git at videolan.org
Sun Sep 17 17:50:41 EEST 2017


ffmpeg | branch: release/3.1 | Vitaly Buka <vitalybuka-at-google.com at ffmpeg.org> | Sun Aug 20 11:56:47 2017 -0700| [7b6dba892f63a620d4510c9114f414cfa6435942] | committer: Michael Niedermayer

avformat/mov: Fix signed integer overflows with total_size

Signed integer overflow is undefined behavior.
Detected with clang and -fsanitize=signed-integer-overflow

Signed-off-by: Vitaly Buka <vitalybuka at google.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 4a404cb5b90b878cbe1bb528fac65cf508668cc5)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/mov.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index a77d6908e3..1815a7303f 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4415,7 +4415,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
     if (atom.size < 0)
         atom.size = INT64_MAX;
-    while (total_size + 8 <= atom.size && !avio_feof(pb)) {
+    while (total_size <= atom.size - 8 && !avio_feof(pb)) {
         int (*parse)(MOVContext*, AVIOContext*, MOVAtom) = NULL;
         a.size = atom.size;
         a.type=0;



More information about the ffmpeg-cvslog mailing list