1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

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@niedermayer.cc>
(cherry picked from commit d88c284c18)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2024-03-30 19:51:43 +01:00
parent dcd1ed180b
commit 7915f6147c
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64

View File

@ -5962,6 +5962,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) {