diff mbox series

[FFmpeg-devel,3/6] avformat/mov: Use av_sat_add64() in mov_read_sidx()

Message ID 20201031224633.27872-3-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
This avoids a potential integer overflow, no testcase is known

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 8a66fb9674..3abb9d3e99 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -5023,7 +5023,7 @@  static int mov_read_trun(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 {
     int64_t stream_size = avio_size(pb);
-    int64_t offset = avio_tell(pb) + atom.size, pts, timestamp;
+    int64_t offset = av_sat_add64(avio_tell(pb), atom.size), pts, timestamp;
     uint8_t version, is_complete;
     unsigned i, j, track_id, item_count;
     AVStream *st = NULL;