avformat/mux: use only valid timestamps when calculating packet distance

Fixes: signed integer overflow: 0 - -9223372036854775808 cannot be represented in type 'long int'
Fixes: fate-cover-art-aiff-id3v2-remux, fate-cover-art-mp3-id3v2-remux and fate-mov-cover-image
under ubsan.

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2022-12-28 18:36:11 -03:00
parent 6e05622216
commit 99e3d26f20
1 changed files with 1 additions and 0 deletions

View File

@ -951,6 +951,7 @@ int ff_interleave_packet_per_dts(AVFormatContext *s, AVPacket *pkt,
if (s->max_interleave_delta > 0 &&
si->packet_buffer.head &&
si->packet_buffer.head->pkt.dts != AV_NOPTS_VALUE &&
!flush &&
si->nb_interleaved_streams == stream_count+noninterleaved_count
) {