diff mbox series

[FFmpeg-devel,2/6] avformat/mov: Avoid overflow in end computation in mov_read_custom()

Message ID 20201031224633.27872-2-michael@niedermayer.cc
State New
Headers show
Series [FFmpeg-devel,1/6] avformat/avidec: Use av_sat_sub64() in check_stream_max_drift()
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished

Commit Message

Michael Niedermayer Oct. 31, 2020, 10:46 p.m. UTC
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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index c8a38ec4df..8a66fb9674 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4385,7 +4385,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;