avfilter/vf_scale: Fix integer overflow in config_props()

Fixes: signed integer overflow: 536870944 * 16 cannot be represented in type 'int'
Fixes: #21587

Found-by: HAORAN FANG
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 9adced3278)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2026-03-03 20:24:36 +01:00
parent ebc1d9d63b
commit 7c5c45ec12
No known key found for this signature in database
GPG key ID: B18E8928B3948D64

View file

@ -643,8 +643,8 @@ static int config_props(AVFilterLink *outlink)
if (outlink->w > INT_MAX ||
outlink->h > INT_MAX ||
(outlink->h * inlink->w) > INT_MAX ||
(outlink->w * inlink->h) > INT_MAX)
(outlink->h * (uint64_t)inlink->w) > INT_MAX ||
(outlink->w * (uint64_t)inlink->h) > INT_MAX)
av_log(ctx, AV_LOG_ERROR, "Rescaled value for width or height is too big.\n");
/* TODO: make algorithm configurable */