[FFmpeg-cvslog] avformat/movenc: Check that cts fits in 32bit

Michael Niedermayer git at videolan.org
Sun Apr 14 04:44:56 EEST 2024


ffmpeg | branch: release/6.1 | Michael Niedermayer <michael at niedermayer.cc> | Sat Mar 30 19:51:43 2024 +0100| [56999f9353c0980e76d771f2988cdc41ff40cb26] | committer: Michael Niedermayer

avformat/movenc: Check that cts fits in 32bit

Fixes: Assertion av_rescale_rnd(start_dts, mov->movie_timescale, track->timescale, AV_ROUND_DOWN) <= 0 failed at libavformat/movenc.c:3694
Fixes: poc2

Found-by: Wang Dawei and Zhou Geng, from Zhongguancun Laboratory
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit d88c284c18bf6cd3dd24a7c86b5e496dd3037405)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/movenc.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index e39f1ac987..6604b019b4 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -6102,6 +6102,12 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
     if (ret < 0)
         return ret;
 
+    if (pkt->pts != AV_NOPTS_VALUE &&
+        (uint64_t)pkt->dts - pkt->pts != (int32_t)((uint64_t)pkt->dts - pkt->pts)) {
+        av_log(s, AV_LOG_WARNING, "pts/dts pair unsupported\n");
+        return AVERROR_PATCHWELCOME;
+    }
+
     if (mov->flags & FF_MOV_FLAG_FRAGMENT || mov->mode == MODE_AVIF) {
         int ret;
         if (mov->moov_written || mov->flags & FF_MOV_FLAG_EMPTY_MOOV) {



More information about the ffmpeg-cvslog mailing list