Commit 8716f3fe9e for ffmpeg

commit 8716f3fe9e2bc3fb10b9f41a9ee1e1048d8ae036
Author: Michael Niedermayer <michael@niedermayer.cc>
Date:   Wed Nov 11 23:33:29 2026 +0100

    avfilter/af_surround: apply a new overlap before taking the next frame

    Fixes: negative size memset
    Fixes: 1qnBq4rDE31l

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

    Negative size memset Replicated through UnModified FFmpeg with ASAN

diff --git a/libavfilter/af_surround.c b/libavfilter/af_surround.c
index 4e23e422ff..455d5dbe10 100644
--- a/libavfilter/af_surround.c
+++ b/libavfilter/af_surround.c
@@ -1353,6 +1353,7 @@ static int activate(AVFilterContext *ctx)

     FF_FILTER_FORWARD_STATUS_BACK(outlink, inlink);

+    s->hop_size = FFMAX(1, s->win_size * (1. - s->overlap));
     ret = ff_inlink_consume_samples(inlink, s->hop_size, s->hop_size, &in);
     if (ret < 0)
         return ret;
@@ -1416,15 +1417,12 @@ static av_cold void uninit(AVFilterContext *ctx)
 static int process_command(AVFilterContext *ctx, const char *cmd, const char *args,
                            char *res, int res_len, int flags)
 {
-    AudioSurroundContext *s = ctx->priv;
     int ret;

     ret = ff_filter_process_command(ctx, cmd, args, res, res_len, flags);
     if (ret < 0)
         return ret;

-    s->hop_size = FFMAX(1, s->win_size * (1. - s->overlap));
-
     allchannels_spread(ctx);
     set_input_levels(ctx);
     set_output_levels(ctx);