This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch release/7.1 in repository ffmpeg.
commit dbb003524ce60cf3d3a86638932c5a445e23c775 Author: Michael Niedermayer <[email protected]> AuthorDate: Thu Jan 22 21:11:34 2026 +0100 Commit: Michael Niedermayer <[email protected]> CommitDate: Mon May 4 15:57:09 2026 +0200 fftools/ffmpeg_opt: limit recursion of presets Fixes: stack overflow This should have limited security impact as it requires access to arbitrary options. Found-by: Zhenpeng (Leo) Lin from depthfirst Signed-off-by: Michael Niedermayer <[email protected]> (cherry picked from commit 0833dd3665baede81ae700ae7e04a7c5143984af) Signed-off-by: Michael Niedermayer <[email protected]> --- fftools/ffmpeg.h | 2 ++ fftools/ffmpeg_opt.c | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/fftools/ffmpeg.h b/fftools/ffmpeg.h index 733d551fa4..83ccc4134c 100644 --- a/fftools/ffmpeg.h +++ b/fftools/ffmpeg.h @@ -254,6 +254,8 @@ typedef struct OptionsContext { SpecifierOptList enc_stats_pre_fmt; SpecifierOptList enc_stats_post_fmt; SpecifierOptList mux_stats_fmt; + + int depth; } OptionsContext; enum IFilterFlags { diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index f639a1cf0a..071c35ff43 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -1008,6 +1008,12 @@ static int opt_preset(void *optctx, const char *opt, const char *arg) char filename[1000], line[1000], tmp_line[1000]; const char *codec_name = NULL; int ret = 0; + int depth = o->depth; + + if (depth > 2) { + av_log(NULL, AV_LOG_ERROR, "too deep recursion\n"); + return AVERROR(EINVAL); + } codec_name = opt_match_per_type_str(&o->codec_names, *opt); @@ -1019,6 +1025,7 @@ static int opt_preset(void *optctx, const char *opt, const char *arg) return AVERROR(ENOENT); } + o->depth ++; while (fgets(line, sizeof(line), f)) { char *key = tmp_line, *value, *endptr; @@ -1046,6 +1053,7 @@ static int opt_preset(void *optctx, const char *opt, const char *arg) } fail: + o->depth = depth; fclose(f); return ret; _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
