diff mbox

[FFmpeg-devel,1/2] avformat/utils: Fix integer overflow in discontinuity check

Message ID 20181012014021.9579-1-michael@niedermayer.cc
State Accepted
Commit 4e19cfcfa3944fe4cf97bea758f72f104dcaebad
Headers show

Commit Message

Michael Niedermayer Oct. 12, 2018, 1:40 a.m. UTC
Fixes: signed integer overflow: 7738135736989908991 - -7954308516317364223 cannot be represented in type 'long'
Fixes: find_stream_info_usan

Reported-by: Thomas Guilbert <tguilbert@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Niedermayer Oct. 18, 2018, 12:22 a.m. UTC | #1
On Fri, Oct 12, 2018 at 03:40:20AM +0200, Michael Niedermayer wrote:
> Fixes: signed integer overflow: 7738135736989908991 - -7954308516317364223 cannot be represented in type 'long'
> Fixes: find_stream_info_usan
> 
> Reported-by: Thomas Guilbert <tguilbert@google.com>
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

will apply

[...]
diff mbox

Patch

diff --git a/libavformat/utils.c b/libavformat/utils.c
index a8ac90213e..fa3699daef 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3818,7 +3818,7 @@  FF_ENABLE_DEPRECATION_WARNINGS
              * sequence, we treat it as a discontinuity. */
             if (st->info->fps_last_dts != AV_NOPTS_VALUE &&
                 st->info->fps_last_dts_idx > st->info->fps_first_dts_idx &&
-                (pkt->dts - st->info->fps_last_dts) / 1000 >
+                (pkt->dts - (uint64_t)st->info->fps_last_dts) / 1000 >
                 (st->info->fps_last_dts     - (uint64_t)st->info->fps_first_dts) /
                 (st->info->fps_last_dts_idx - st->info->fps_first_dts_idx)) {
                 av_log(ic, AV_LOG_WARNING,