Commit 573784882c for ffmpeg

commit 573784882c12abf0f6c30978d6b748457dd6a218
Author: Michael Niedermayer <michael@niedermayer.cc>
Date:   Thu Nov 12 01:31:47 2026 +0100

    avfilter/af_ladspa: check the control index before using it

    Fixes: out of array read
    Fixes: okPC857hfRXh

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

    Out of array read Replicated through UnModified FFmpeg with ASAN

diff --git a/libavfilter/af_ladspa.c b/libavfilter/af_ladspa.c
index ea5eb1a2ef..cf51c8bea5 100644
--- a/libavfilter/af_ladspa.c
+++ b/libavfilter/af_ladspa.c
@@ -452,8 +452,7 @@ static int set_control(AVFilterContext *ctx, unsigned long port, LADSPA_Data val
 {
     LADSPAContext *s = ctx->priv;
     const char *label = s->desc->Label;
-    LADSPA_PortRangeHint *h = (LADSPA_PortRangeHint *)s->desc->PortRangeHints +
-                              s->icmap[port];
+    LADSPA_PortRangeHint *h;

     if (port >= s->nb_inputcontrols) {
         av_log(ctx, AV_LOG_ERROR, "Control c%ld is out of range [0 - %lu].\n",
@@ -461,6 +460,8 @@ static int set_control(AVFilterContext *ctx, unsigned long port, LADSPA_Data val
         return AVERROR(EINVAL);
     }

+    h = (LADSPA_PortRangeHint *)s->desc->PortRangeHints + s->icmap[port];
+
     if (LADSPA_IS_HINT_BOUNDED_BELOW(h->HintDescriptor) &&
             value < h->LowerBound) {
         av_log(ctx, AV_LOG_ERROR,