]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mov: Avoid overflow in end computation in mov_read_custom()
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 31 Oct 2020 11:01:50 +0000 (12:01 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Fri, 4 Dec 2020 23:08:33 +0000 (00:08 +0100)
Fixes: signed integer overflow: 18 + 9223372036854775799 cannot be represented in type 'long'
Fixes: 26731/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5696846019952640
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mov.c

index 175d5a3cc25a51fe0b84dc61aee620a5da469961..ed34130034a3cb846fc9cf7190fc3c7f832c9fcf 100644 (file)
@@ -4414,7 +4414,7 @@ static int mov_read_keys(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
 static int mov_read_custom(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
-    int64_t end = avio_tell(pb) + atom.size;
+    int64_t end = av_sat_add64(avio_tell(pb), atom.size);
     uint8_t *key = NULL, *val = NULL, *mean = NULL;
     int i;
     int ret = 0;