Commit e7f4912140 for ffmpeg
commit e7f4912140d5d47c08d2c3fa49f9167972a79afe
Author: Michael Niedermayer <michael@niedermayer.cc>
Date: Thu Nov 12 01:20:32 2026 +0100
avfilter/f_streamselect: reject a map with more entries than outputs
Fixes: out of array read
Fixes: wShaWIYvxHRE
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/f_streamselect.c b/libavfilter/f_streamselect.c
index cce74b6dde..f9702b81ce 100644
--- a/libavfilter/f_streamselect.c
+++ b/libavfilter/f_streamselect.c
@@ -225,7 +225,7 @@ static int parse_mapping(AVFilterContext *ctx, const char *map)
new_map[new_nb_map++] = n;
}
- if (!new_nb_map) {
+ if (!new_nb_map || new_nb_map > ctx->nb_outputs) {
av_log(ctx, AV_LOG_ERROR, "invalid mapping\n");
av_free(new_map);
return AVERROR(EINVAL);