History

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`

Kacper Michajłow committed 1 year ago

Commit 5f62e2d1 parent 30043cc1 file · +3 −2Browse files

Unified · Split

fftools/cmdutils.c+3−2
@@ -255,9 +255,10 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt, · 254 unmodified lines
255255 if (*opt == '/') {
256256 opt++;
257257
258− if (po->type == OPT_TYPE_BOOL) {
258+ if (!opt_has_arg(po)) {
259259 av_log(NULL, AV_LOG_FATAL,
260− "Requested to load an argument from file for a bool option '%s'\n",
260+ "Requested to load an argument from file for an option '%s'"
261+ " which does not take an argument\n",
261262 po->name);
262263 return AVERROR(EINVAL);
263264 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t