Commit e259604514 for ffmpeg

commit e259604514c80f5076eb42485e469afae05e2ca8
Author: Michael Niedermayer <michael@niedermayer.cc>
Date:   Mon Oct 26 16:02:53 2026 +0100

    avfilter/vf_bm3d: clamp the search range to the plane size

    Fixes: signed integer overflow
    Found during triage/review of the security report fH770hlenwcI
    Signed integer overflow Replicated through UnModified FFmpeg with UBSAN

diff --git a/libavfilter/vf_bm3d.c b/libavfilter/vf_bm3d.c
index f71845cd60..58910e2414 100644
--- a/libavfilter/vf_bm3d.c
+++ b/libavfilter/vf_bm3d.c
@@ -314,7 +314,7 @@ static void block_matching_multi(BM3DContext *s, const uint8_t *ref, int ref_lin
     const int height = s->planeheight[plane];
     const int block_size = s->block_size;
     const int step = s->bm_step;
-    const int range = s->bm_range / step * step;
+    const int range = FFMIN(s->bm_range, FFMAX(width, height)) / step * step;
     int l = search_boundary(0, range, step, 0, y, x);
     int r = search_boundary(width - block_size, range, step, 0, y, x);
     int t = search_boundary(0, range, step, 1, y, x);