[FFmpeg-cvslog] avformat/mov: Fix incorrect overflow detection in mov_read_sidx()

Michael Niedermayer git at videolan.org
Wed Sep 8 22:43:25 EEST 2021


ffmpeg | branch: release/4.4 | Michael Niedermayer <michael at niedermayer.cc> | Wed Apr 28 16:53:52 2021 +0200| [da9e84fabd0285204df60a032e0846fe70be0068] | committer: Michael Niedermayer

avformat/mov: Fix incorrect overflow detection in mov_read_sidx()

Fixes: signed integer overflow: 9223372036854775807 + 1442840321 cannot be represented in type 'long'
Fixes: 33670/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6644379491106816

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 200406d930eff3202f3230f188f85f4ab9cf4525)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 56c538cf63..b49dd01543 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5132,7 +5132,7 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom)
         if (frag_stream_info)
             frag_stream_info->sidx_pts = timestamp;
 
-        if (av_sat_add64(offset, size) != offset + size ||
+        if (av_sat_add64(offset, size) != offset + (uint64_t)size ||
             av_sat_add64(pts, duration) != pts + (uint64_t)duration
         )
             return AVERROR_INVALIDDATA;



More information about the ffmpeg-cvslog mailing list