diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 7a4b5fed72..e2d53d1a7b 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -475,6 +475,8 @@ static int opt_map(void *optctx, const char *opt, const char *arg) for (i = 0; i < o->nb_stream_maps; i++) { m = &o->stream_maps[i]; if (file_idx == m->file_index && + m->stream_index >= 0 && + m->stream_index < input_files[m->file_index]->nb_streams && check_stream_specifier(input_files[m->file_index]->ctx, input_files[m->file_index]->ctx->streams[m->stream_index], *p == ':' ? p + 1 : p) > 0)