镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

tools/cli_parse: report invalid --threads, --subsample and --cpumask values - #1695

Open
sebxt wants to merge 1 commit into
Netflix:masterfrom
sebxt:fix/cli-unsigned-option-assert
Open

sebxt wants to merge 1 commit into
Netflix:masterfrom
sebxt:fix/cli-unsigned-option-assert

Conversation

@sebxt

@sebxt sebxt commented Oct 20, 2026

Copy link
Copy Markdown

A non-integer value for --threads, --subsample or --cpumask made the vmaf tool abort in error() with Assertion failed: (long_opts[n].name) instead of printing usage.

These cases passed 't', 's' and 'c' to parse_unsigned(), but the long options are registered with ARG_THREADS, ARG_SUBSAMPLE and ARG_CPUMASK, so error() could not find the option in long_opts. Pass the ARG_* values, as --gpumask and --frame_cnt already do.

After the change:

$ vmaf -r ref.y4m -d dis.y4m --threads abc
Invalid argument "abc" for option --threads; should be an integer

Testing: added test_invalid_unsigned_option_prints_usage to test_cli_parse. It runs cli_parse() in a child process, since usage() exits, and checks for exit status 1. It fails on master (the child aborts) and passes with the fix. It is skipped on Windows, where fork() is not available. ninja -C libvmaf/build test passes (28/28).

Fixes #1694

…values

Signed-off-by: Sebastian Turner <sebastiant3484@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

vmaf CLI aborts on a non-integer value for --threads, --subsample or --cpumask

1 participant