Commit d0c6555bb1 for ffmpeg

commit d0c6555bb192ad1c654d0ed0bb756e246e68a04d
Author: Michael Niedermayer <michael@niedermayer.cc>
Date:   Thu Nov 12 20:06:12 2026 +0100

    avfilter/vf_convolution: filter with the mode the functions were selected for

    Fixes: out of array write
    Fixes: JDGDab47U8W3

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

    Out of array write Replicated through UnModified FFmpeg with ASAN
    no further issues found with 3000 iterations of a random sendcmd command fuzzer

diff --git a/libavfilter/convolution.h b/libavfilter/convolution.h
index 71ec3b6804..f26140e29c 100644
--- a/libavfilter/convolution.h
+++ b/libavfilter/convolution.h
@@ -38,6 +38,7 @@ typedef struct ConvolutionContext {
     float user_rdiv[4];
     float bias[4];
     int mode[4];
+    int active_mode[4];
     float scale;
     float delta;
     int planes;
diff --git a/libavfilter/vf_convolution.c b/libavfilter/vf_convolution.c
index cf772af328..76092b41fb 100644
--- a/libavfilter/vf_convolution.c
+++ b/libavfilter/vf_convolution.c
@@ -570,7 +570,7 @@ static int filter_slice(AVFilterContext *ctx, void *arg, int jobnr, int nb_jobs)
     int plane;

     for (plane = 0; plane < s->nb_planes; plane++) {
-        const int mode = s->mode[plane];
+        const int mode = s->active_mode[plane];
         const int bpc = s->bpc;
         const int radius = s->size[plane] / 2;
         const int height = s->planeheight[plane];
@@ -710,6 +710,7 @@ static int param_init(AVFilterContext *ctx)
             } else {
                 return AVERROR(EINVAL);
             }
+            s->active_mode[i] = s->mode[i];

             if (sum == 0)
                 sum = 1;