[FFmpeg-cvslog] avformat/mov: Fix integer overflow in mov_read_packet().

Dale Curtis git at videolan.org
Sun Apr 14 20:33:28 EEST 2024


ffmpeg | branch: release/5.1 | Dale Curtis <dalecurtis at chromium.org> | Wed Nov 22 22:17:37 2023 +0000| [8f209d2c90e84cd250f1a4667d1d83ec196f51dc] | committer: Michael Niedermayer

avformat/mov: Fix integer overflow in mov_read_packet().

Fixes https://crbug.com/1499669:
runtime error: signed integer overflow: 9223372036853334272 + 1375731456
cannot be represented in type 'int64_t' (aka 'long')

Signed-off-by: Dale Curtis <dalecurtis at chromium.org>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 2182173a6933c02b0853751034bd5e0bf829b5f7)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

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

diff --git a/libavformat/mov.c b/libavformat/mov.c
index bad0063f67..7507ffe47e 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -8757,7 +8757,7 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
         pkt->flags |= AV_PKT_FLAG_DISCARD;
     }
     if (sc->ctts_data && sc->ctts_index < sc->ctts_count) {
-        pkt->pts = pkt->dts + sc->dts_shift + sc->ctts_data[sc->ctts_index].duration;
+        pkt->pts = av_sat_add64(pkt->dts, av_sat_add64(sc->dts_shift, sc->ctts_data[sc->ctts_index].duration));
         /* update ctts context */
         sc->ctts_sample++;
         if (sc->ctts_index < sc->ctts_count &&



More information about the ffmpeg-cvslog mailing list