Commit c64c18d1fc for ffmpeg
commit c64c18d1fc27cd8fa142ea0ff9bd035f5dd9a46a
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Sat Nov 7 00:11:38 2026 +0100
avfilter/vf_separatefields: require an even chroma height
With an odd number of rows in a vertically subsampled plane, the bottom
field has one row less than the output height requires
Fixes: heap-buffer-overflow (read)
Fixes: NVD0gxXiKQI9
Found during triage of the security report i9omtrAF7zcc
Out of array read Replicated through UnModified FFmpeg with ASAN
diff --git a/libavfilter/vf_separatefields.c b/libavfilter/vf_separatefields.c
index c0c0640dcc..4c50f5beeb 100644
--- a/libavfilter/vf_separatefields.c
+++ b/libavfilter/vf_separatefields.c
@@ -35,6 +35,7 @@ static int config_props_output(AVFilterLink *outlink)
AVFilterLink *inlink = ctx->inputs[0];
FilterLink *il = ff_filter_link(inlink);
FilterLink *ol = ff_filter_link(outlink);
+ const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format);
s->nb_planes = av_pix_fmt_count_planes(inlink->format);
@@ -42,6 +43,10 @@ static int config_props_output(AVFilterLink *outlink)
av_log(ctx, AV_LOG_ERROR, "height must be even\n");
return AVERROR_INVALIDDATA;
}
+ if (AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h) & 1) {
+ av_log(ctx, AV_LOG_ERROR, "chroma height must be even\n");
+ return AVERROR_INVALIDDATA;
+ }
outlink->time_base.num = inlink->time_base.num;
outlink->time_base.den = inlink->time_base.den * 2;