diff mbox series

[FFmpeg-devel,4/4] avformat/utils: Fix integer overflow with complex time bases in avformat_find_stream_info()

Message ID 20200215225105.12141-4-michael@niedermayer.cc
State Accepted
Headers show
Series [FFmpeg-devel,1/4] avfilter/vf_aspect: Fix integer overflow in compute_dar() | expand

Checks

Context Check Description
andriy/ffmpeg-patchwork success Make fate finished

Commit Message

Michael Niedermayer Feb. 15, 2020, 10:51 p.m. UTC
Fixes: signed integer overflow: 2045163756 * 2 cannot be represented in type 'int'
Fixes: Ticket5132

Found-by: tsmith
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
---
 libavformat/utils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paul B Mahol Feb. 16, 2020, 11:23 a.m. UTC | #1
probably ok

On 2/15/20, Michael Niedermayer <michael@niedermayer.cc> wrote:
> Fixes: signed integer overflow: 2045163756 * 2 cannot be represented in type
> 'int'
> Fixes: Ticket5132
>
> Found-by: tsmith
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavformat/utils.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 7ff5ea9702..a220e4bc30 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -4062,7 +4062,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
>
>              if (!st->r_frame_rate.num) {
>                  if (    avctx->time_base.den * (int64_t) st->time_base.num
> -                    <= avctx->time_base.num * avctx->ticks_per_frame *
> (int64_t) st->time_base.den) {
> +                    <= avctx->time_base.num * avctx->ticks_per_frame *
> (uint64_t) st->time_base.den) {
>                      av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den,
>                                avctx->time_base.den,
> (int64_t)avctx->time_base.num * avctx->ticks_per_frame, INT_MAX);
>                  } else {
> --
> 2.17.1
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Michael Niedermayer Feb. 16, 2020, 2:47 p.m. UTC | #2
On Sun, Feb 16, 2020 at 12:23:56PM +0100, Paul B Mahol wrote:
> probably ok

will apply

thx

[...]
diff mbox series

Patch

diff --git a/libavformat/utils.c b/libavformat/utils.c
index 7ff5ea9702..a220e4bc30 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4062,7 +4062,7 @@  FF_ENABLE_DEPRECATION_WARNINGS
 
             if (!st->r_frame_rate.num) {
                 if (    avctx->time_base.den * (int64_t) st->time_base.num
-                    <= avctx->time_base.num * avctx->ticks_per_frame * (int64_t) st->time_base.den) {
+                    <= avctx->time_base.num * avctx->ticks_per_frame * (uint64_t) st->time_base.den) {
                     av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den,
                               avctx->time_base.den, (int64_t)avctx->time_base.num * avctx->ticks_per_frame, INT_MAX);
                 } else {