Commit 57bc26976f for ffmpeg

commit 57bc26976f82490db636182d6852066eae567ccb
Author: Michael Niedermayer <michael@niedermayer.cc>
Date:   Sat Nov 14 01:57:51 2026 +0100

    avfilter/vf_median: mask the histogram bins of high bit depth samples

    Fixes: out of array write
    Fixes: M6ZGmNclqAuM

    Found during triage of the security report AISLE-2026-R0057

    Out of array write Replicated through UnModified FFmpeg with ASAN

diff --git a/libavfilter/median_template.c b/libavfilter/median_template.c
index 57ee7cb7e5..e18dd12698 100644
--- a/libavfilter/median_template.c
+++ b/libavfilter/median_template.c
@@ -44,8 +44,8 @@
 #define fn2(a,b)   fn3(a,b)
 #define fn(a)      fn2(a, DEPTH)

-#define PICK_COARSE_BIN(x, y) (BINS * (x) + ((y) >> SHIFT))
-#define PICK_FINE_BIN(x, y, z) (BINS * ((x) * ((y) >> SHIFT) + (z)) + ((y) & MASK))
+#define PICK_COARSE_BIN(x, y) (BINS * (x) + (((y) >> SHIFT) & MASK))
+#define PICK_FINE_BIN(x, y, z) (BINS * ((x) * (((y) >> SHIFT) & MASK) + (z)) + ((y) & MASK))

 static void fn(filter_plane)(AVFilterContext *ctx, const uint8_t *ssrc, int src_linesize,
                              uint8_t *ddst, int dst_linesize, int width, int height,