Commit e196e57ca2 for ffmpeg

commit e196e57ca225a98654e482806fa714facd232b57
Author: Martin Mirchev <mmirchev@comp.nus.edu.sg>
Date:   Sun Oct 18 19:38:12 2026 +0800

    avfilter/vf_fillborders: reject borders of half the frame in reflect mode

    Reflect mode mirrors around the edge pixel without repeating it, so a
    border of n lines reads lines up to 2 * n away from the edge. The
    borders were only checked against half the frame size, which is enough
    for mirror mode but not here: with bottom or right equal to half the
    height or width the filter read before the start of the plane, and with
    top or left equal to half it reflected lines outside the image.

    Signed-off-by: Martin Mirchev <mmirchev@comp.nus.edu.sg>

diff --git a/libavfilter/vf_fillborders.c b/libavfilter/vf_fillborders.c
index 0ee4f14ab9..3ba009dae4 100644
--- a/libavfilter/vf_fillborders.c
+++ b/libavfilter/vf_fillborders.c
@@ -617,6 +617,14 @@ static int config_input(AVFilterLink *inlink)
         return AVERROR(EINVAL);
     }

+    /* reflect does not repeat the edge pixel, so it reads 2 * border + 1 lines */
+    if (s->mode == FM_REFLECT &&
+        (inlink->w <= s->left * 2 || inlink->w <= s->right * 2 ||
+         inlink->h <= s->top  * 2 || inlink->h <= s->bottom * 2)) {
+        av_log(ctx, AV_LOG_ERROR, "Borders must be smaller than half the input frame size in reflect mode.\n");
+        return AVERROR(EINVAL);
+    }
+
     s->borders[0].left   = s->borders[3].left = s->left;
     s->borders[0].right  = s->borders[3].right = s->right;
     s->borders[0].top    = s->borders[3].top = s->top;