[FFmpeg-cvslog] avformat/mov: Check size before subtraction

Michael Niedermayer git at videolan.org
Wed Apr 6 22:55:41 EEST 2022


ffmpeg | branch: release/4.3 | Michael Niedermayer <michael at niedermayer.cc> | Mon Jan 17 14:26:05 2022 +0100| [3a718e3bbb73f3cfb7d8eb5d00795e0c615e1226] | committer: Michael Niedermayer

avformat/mov: Check size before subtraction

Fixes: signed integer overflow: -9223372036854775808 - 8 cannot be represented in type 'long'
Fixes: 43542/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5237670148702208

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 d8d9d506a3de976b647bcbb8f76c7b8d30eff576)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/mov.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index c517830aef..e6785e884e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -7050,6 +7050,8 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
         if (a.size == 0) {
             a.size = atom.size - total_size + 8;
         }
+        if (a.size < 0)
+            break;
         a.size -= 8;
         if (a.size < 0)
             break;



More information about the ffmpeg-cvslog mailing list