Commit bdbb6ad49c for ffmpeg

commit bdbb6ad49cedcd4706c2cfee8eace894ae1a0452
Author: Michael Niedermayer <michael@niedermayer.cc>
Date:   Thu Nov 12 01:19:10 2026 +0100

    avfilter/vf_feedback: clamp the position without integer overflow

    Fixes: out of array read
    Fixes: signed integer overflow
    Fixes: hrmKDBP9CvuA

    Found during the triage of a finding from the review of https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25800

    Out of array read Replicated through UnModified FFmpeg with ASAN
    Signed integer overflow Replicated through UnModified FFmpeg with UBSAN

diff --git a/libavfilter/vf_feedback.c b/libavfilter/vf_feedback.c
index e3633d7d37..0665bde221 100644
--- a/libavfilter/vf_feedback.c
+++ b/libavfilter/vf_feedback.c
@@ -46,10 +46,8 @@ typedef struct FeedbackContext {

 static void adjust_pos(AVFilterContext *ctx, FeedbackContext *s)
 {
-    if (s->x + s->w > ctx->inputs[0]->w)
-        s->x = ctx->inputs[0]->w - s->w;
-    if (s->y + s->h > ctx->inputs[0]->h)
-        s->y = ctx->inputs[0]->h - s->h;
+    s->x = FFMIN(s->x, ctx->inputs[0]->w - s->w);
+    s->y = FFMIN(s->y, ctx->inputs[0]->h - s->h);
 }

 static void adjust_parameters(AVFilterContext *ctx, FeedbackContext *s)