[FFmpeg-devel] [PATCH] avfilter/scale: fix CID 1457833
Anton Khirnov
anton at khirnov.net
Thu Jan 16 17:37:02 EET 2020
Quoting Gyan Doshi (2020-01-16 13:59:47)
> ---
> libavfilter/vf_scale.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/libavfilter/vf_scale.c b/libavfilter/vf_scale.c
> index d46c767e70..70978345e8 100644
> --- a/libavfilter/vf_scale.c
> +++ b/libavfilter/vf_scale.c
> @@ -498,10 +498,8 @@ static int config_props(AVFilterLink *outlink)
> scale->force_original_aspect_ratio,
> scale->force_divisible_by);
>
> - if (scale->w > INT_MAX ||
> - scale->h > INT_MAX ||
> - (scale->h * inlink->w) > INT_MAX ||
> - (scale->w * inlink->h) > INT_MAX)
> + if (((int64_t)scale->h * inlink->w) > INT_MAX ||
> + ((int64_t)scale->w * inlink->h) > INT_MAX)
This only works when int is 32bit, which is not guaranteed to be true.
The correct way to test it is something like
if (scale->h > INT_MAX / inlink->w)
Also, the commit message has all the usefulness of "fix bug". It should
say what is actually being fixed.
--
Anton Khirnov
More information about the ffmpeg-devel
mailing list