diff mbox series

[FFmpeg-devel] avfilter/vf_crop: prevent integer overflows when calculating SAR

Message ID 20240709203241.41569-1-jamrial@gmail.com
State New
Headers show
Series [FFmpeg-devel] avfilter/vf_crop: prevent integer overflows when calculating SAR | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 fail Make fate failed
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

James Almer July 9, 2024, 8:32 p.m. UTC
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavfilter/vf_crop.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

James Almer July 11, 2024, 12:44 p.m. UTC | #1
On 7/9/2024 5:32 PM, James Almer wrote:
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>   libavfilter/vf_crop.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c
> index 6361209941..d4966323f5 100644
> --- a/libavfilter/vf_crop.c
> +++ b/libavfilter/vf_crop.c
> @@ -206,7 +206,7 @@ static int config_input(AVFilterLink *link)
>           AVRational dar = av_mul_q(link->sample_aspect_ratio,
>                                     (AVRational){ link->w, link->h });
>           av_reduce(&s->out_sar.num, &s->out_sar.den,
> -                  dar.num * s->h, dar.den * s->w, INT_MAX);
> +                  (int64_t)dar.num * s->h, (int64_t)dar.den * s->w, INT_MAX);
>       } else
>           s->out_sar = link->sample_aspect_ratio;

Will apply.
diff mbox series

Patch

diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c
index 6361209941..d4966323f5 100644
--- a/libavfilter/vf_crop.c
+++ b/libavfilter/vf_crop.c
@@ -206,7 +206,7 @@  static int config_input(AVFilterLink *link)
         AVRational dar = av_mul_q(link->sample_aspect_ratio,
                                   (AVRational){ link->w, link->h });
         av_reduce(&s->out_sar.num, &s->out_sar.den,
-                  dar.num * s->h, dar.den * s->w, INT_MAX);
+                  (int64_t)dar.num * s->h, (int64_t)dar.den * s->w, INT_MAX);
     } else
         s->out_sar = link->sample_aspect_ratio;