]> git.sesse.net Git - ffmpeg/commitdiff
avformat/mpegenc: Fix integer overflow with AV_NOPTS_VALUE
authorMichael Niedermayer <michael@niedermayer.cc>
Sun, 16 Feb 2020 17:51:52 +0000 (18:51 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 21 May 2020 07:31:08 +0000 (09:31 +0200)
Fixes: signed integer overflow: -9223372036854775808 - 45000 cannot be represented in type 'long'
Fixes: ticket8187
Found-by: Suhwan
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mpegenc.c

index 669ff9d152b83d53c9186d1fcb5b0925f338b532..9bd0a555d464e33fe33162d6b20074005d7efaaf 100644 (file)
@@ -1210,7 +1210,7 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt)
     if (s->is_dvd) {
         // min VOBU length 0.4 seconds (mpucoder)
         if (is_iframe &&
-            (s->packet_number == 0 ||
+            (s->packet_number == 0 || pts != AV_NOPTS_VALUE &&
              (pts - stream->vobu_start_pts >= 36000))) {
             stream->bytes_to_iframe = av_fifo_size(stream->fifo);
             stream->align_iframe    = 1;