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

Michael Niedermayer git at videolan.org
Sun Apr 14 19:36:29 EEST 2024


ffmpeg | branch: release/6.0 | Michael Niedermayer <michael at niedermayer.cc> | Sat Mar 30 19:51:43 2024 +0100| [9ffa59eba5e1867afbb2192e565cd53dfb418fcb] | 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=9ffa59eba5e1867afbb2192e565cd53dfb418fcb
---

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

diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index c4fcb5f8b1..4c34639b0e 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -5986,6 +5986,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