1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-08-04 22:03:09 +02:00

fftools/cmdutils: don't try to load arguments from file if not needed

CLI option parser checks if argument exists when needed, but in this
case only OPT_TYPE_BOOL where checked, so OPT_TYPE_FUNC without argument
where trying to load a file from `arg` which is NULL in this case.

Fixes crash on `ffmpeg -/version`

Fixes: 6d17991b7e
Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Kacper Michajłow
2025-06-30 20:36:09 +02:00
committed by Michael Niedermayer
parent 30043cc167
commit 5f62e2de98

View File

@ -255,9 +255,10 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt,
if (*opt == '/') { if (*opt == '/') {
opt++; opt++;
if (po->type == OPT_TYPE_BOOL) { if (!opt_has_arg(po)) {
av_log(NULL, AV_LOG_FATAL, av_log(NULL, AV_LOG_FATAL,
"Requested to load an argument from file for a bool option '%s'\n", "Requested to load an argument from file for an option '%s'"
" which does not take an argument\n",
po->name); po->name);
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }