Commit 77a09f0741 for ffmpeg

commit 77a09f07412f5990fcd75894896eda059c8f2b73
Author: Michael Niedermayer <michael@niedermayer.cc>
Date:   Thu Oct 15 04:27:22 2026 +0200

    avfilter/vf_fieldmatch: reject heights too small for the comb detection

    Fixes: out of array read
    Fixes: 0fHkOzVCAhre
    Fixes: swarm-OOB-read-in-combed-score-when-height-3-df4610

    Found-by: zhang xingxing <2388969553@qq.com>
    A height check in config_input() was suggested in the report.

    Out of array read Replicated through UnModified FFmpeg with ASAN

    Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

diff --git a/libavfilter/vf_fieldmatch.c b/libavfilter/vf_fieldmatch.c
index d806910364..7ce5d23fdb 100644
--- a/libavfilter/vf_fieldmatch.c
+++ b/libavfilter/vf_fieldmatch.c
@@ -955,6 +955,11 @@ static int config_input(AVFilterLink *inlink)
     const int w = inlink->w;
     const int h = inlink->h;

+    if (h <= fm->blocky / 2 || AV_CEIL_RSHIFT(h, pix_desc->log2_chroma_h) < 4) {
+        av_log(ctx, AV_LOG_ERROR, "Height %d is too small\n", h);
+        return AVERROR(EINVAL);
+    }
+
     fm->scthresh = (int64_t)((w * h * 255.0 * fm->scthresh_flt) / 100.0);

     if ((ret = av_image_alloc(fm->map_data,   fm->map_linesize,   w, h, inlink->format, 32)) < 0 ||