Commit 6b11ad5b57 for ffmpeg

commit 6b11ad5b5724806dbee653482088af4bf4dce97b
Author: Michael Niedermayer <michael@niedermayer.cc>
Date:   Sat Nov 14 00:39:40 2026 +0100

    avfilter/vf_lut2: restrict the pixel formats of the second input when an output depth is set

    Fixes: out of array read
    Fixes: KGLXYgEtxsqI
    Fixes: AISLE-2026-0166-00510

    Found-by: Joshua Rogers (AISLE)

    Out of array read Replicated through UnModified FFmpeg with ASAN

diff --git a/libavfilter/vf_lut2.c b/libavfilter/vf_lut2.c
index cabdc980ea..dfc30754d0 100644
--- a/libavfilter/vf_lut2.c
+++ b/libavfilter/vf_lut2.c
@@ -182,9 +182,11 @@ static int query_formats(const AVFilterContext *ctx,
     if (s->tlut2 || !s->odepth)
         return ff_set_pixel_formats_from_list2(ctx, cfg_in, cfg_out, all_pix_fmts);

-    ret = ff_formats_ref(ff_make_pixel_format_list(all_pix_fmts), &cfg_in[0]->formats);
-    if (ret < 0)
-        return ret;
+    for (int i = 0; i < 2; i++) {
+        ret = ff_formats_ref(ff_make_pixel_format_list(all_pix_fmts), &cfg_in[i]->formats);
+        if (ret < 0)
+            return ret;
+    }

     switch (s->odepth) {
     case 8:  pix_fmts = bit8_pix_fmts;  break;