Commit a1a4a6224f for ffmpeg

commit a1a4a6224ff2ea5dd2a07f8b6aae2c217352e281
Author: Michael Niedermayer <michael@niedermayer.cc>
Date:   Thu Nov 12 01:24:33 2026 +0100

    avfilter/vf_pseudocolor: restore the index when a command fails

    Fixes: out of array read
    Fixes: NULL pointer dereference
    Fixes: leN4LX7HLBxe

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

    Out of array read and NULL pointer dereference Replicated through UnModified FFmpeg with ASAN

diff --git a/libavfilter/vf_pseudocolor.c b/libavfilter/vf_pseudocolor.c
index 793278ce89..e2ffa7b257 100644
--- a/libavfilter/vf_pseudocolor.c
+++ b/libavfilter/vf_pseudocolor.c
@@ -1025,12 +1025,18 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
 static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
                            char *res, int res_len, int flags)
 {
+    PseudoColorContext *s = ctx->priv;
+    int index = s->index;
     int ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);

     if (ret < 0)
         return ret;

-    return config_input(ctx->inputs[0]);
+    ret = config_input(ctx->inputs[0]);
+    if (ret < 0)
+        s->index = index;
+
+    return ret;
 }

 static const AVFilterPad inputs[] = {