diff mbox series

[FFmpeg-devel,1/4] avfilter/vf_aspect: Fix integer overflow in compute_dar()

Message ID 20200215225105.12141-1-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: 1562273630 * 17 cannot be represented in type 'int'
Fixes: Ticket8323

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

Comments

Paul B Mahol Feb. 15, 2020, 11:02 p.m. UTC | #1
LGTM

On 2/15/20, Michael Niedermayer <michael@niedermayer.cc> wrote:
> Fixes: signed integer overflow: 1562273630 * 17 cannot be represented in
> type 'int'
> Fixes: Ticket8323
>
> Found-by: Suhwan
> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
> ---
>  libavfilter/vf_aspect.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libavfilter/vf_aspect.c b/libavfilter/vf_aspect.c
> index c042698ef7..70e7fedc97 100644
> --- a/libavfilter/vf_aspect.c
> +++ b/libavfilter/vf_aspect.c
> @@ -78,7 +78,7 @@ static int filter_frame(AVFilterLink *link, AVFrame
> *frame)
>  static inline void compute_dar(AVRational *dar, AVRational sar, int w, int
> h)
>  {
>      if (sar.num && sar.den) {
> -        av_reduce(&dar->num, &dar->den, sar.num * w, sar.den * h, INT_MAX);
> +        av_reduce(&dar->num, &dar->den, sar.num * (int64_t)w, sar.den *
> (int64_t)h, INT_MAX);
>      } else {
>          av_reduce(&dar->num, &dar->den, w, h, INT_MAX);
>      }
> --
> 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".
diff mbox series

Patch

diff --git a/libavfilter/vf_aspect.c b/libavfilter/vf_aspect.c
index c042698ef7..70e7fedc97 100644
--- a/libavfilter/vf_aspect.c
+++ b/libavfilter/vf_aspect.c
@@ -78,7 +78,7 @@  static int filter_frame(AVFilterLink *link, AVFrame *frame)
 static inline void compute_dar(AVRational *dar, AVRational sar, int w, int h)
 {
     if (sar.num && sar.den) {
-        av_reduce(&dar->num, &dar->den, sar.num * w, sar.den * h, INT_MAX);
+        av_reduce(&dar->num, &dar->den, sar.num * (int64_t)w, sar.den * (int64_t)h, INT_MAX);
     } else {
         av_reduce(&dar->num, &dar->den, w, h, INT_MAX);
     }