diff mbox series

[FFmpeg-devel,2/4] avformat/mpegenc: Fix integer overflow with AV_NOPTS_VALUE

Message ID 20200216194303.819-2-michael@niedermayer.cc
State Accepted
Commit 9874815b1aadadd7fd19aa6aabb7d9193f2f43d5
Headers show
Series [FFmpeg-devel,1/4] avformat/swfenc: Fix integer overflow in frame rate handling
Related show

Checks

Context Check Description
andriy/ffmpeg-patchwork pending
andriy/ffmpeg-patchwork success Applied patch
andriy/ffmpeg-patchwork success Configure finished
andriy/ffmpeg-patchwork success Make finished
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Michael Niedermayer Feb. 16, 2020, 7:43 p.m. UTC
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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer May 21, 2020, 10:16 a.m. UTC | #1
On Sun, Feb 16, 2020 at 08:43:01PM +0100, Michael Niedermayer wrote:
> 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 | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
diff mbox series

Patch

diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index 669ff9d152..9bd0a555d4 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -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;