[FFmpeg-devel] [PATCH 8/8] avfilter/vf_scale: Cleanup some checks

Michael Niedermayer michael at niedermayer.cc
Tue Jul 9 01:24:10 EEST 2024


Fixes: CID1513722 Operands don't affect result

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
---
 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 bf09196e10d..120ff473f2e 100644
--- a/libavfilter/vf_scale.c
+++ b/libavfilter/vf_scale.c
@@ -645,10 +645,8 @@ static int config_props(AVFilterLink *outlink)
     if (ret < 0)
         goto fail;
 
-    if (outlink->w > INT_MAX ||
-        outlink->h > INT_MAX ||
-        (outlink->h * inlink->w) > INT_MAX ||
-        (outlink->w * inlink->h) > INT_MAX)
+    if ((outlink->h * (int64_t)inlink->w) > INT_MAX ||
+        (outlink->w * (int64_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 */
-- 
2.45.2



More information about the ffmpeg-devel mailing list