Commit bbb2faf5c1 for ffmpeg
commit bbb2faf5c1df2599c861aed7880e4724579ca019
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Fri Nov 13 02:07:25 2026 +0100
avfilter/f_select: do not round the result to float
Fixes: heap-buffer-overflow (read)
Found during triage of the security report nw59dSqw4SNa
Out of array read Replicated through UnModified FFmpeg with ASAN
diff --git a/libavfilter/f_select.c b/libavfilter/f_select.c
index c1c93fd973..04eef59c37 100644
--- a/libavfilter/f_select.c
+++ b/libavfilter/f_select.c
@@ -407,7 +407,8 @@ static void select_frame(AVFilterContext *ctx, AVFrame *frame)
} else if (isnan(res) || res < 0) {
select->select_out = 0; /* first output */
} else {
- select->select_out = FFMIN(ceilf(res)-1, select->nb_outputs-1); /* other outputs */
+ unsigned u = ceil(FFMIN(res, select->nb_outputs));
+ select->select_out = FFMIN(u-1, select->nb_outputs-1); /* other outputs */
}
av_log(inlink->dst, AV_LOG_DEBUG, " -> select:%f select_out:%d\n", res, select->select_out);