[Bug]: benchmark_app crashes when an argument value contains '=' or is empty

Open Beginner friendly
#38,196 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
cli

Research direction

Start with get_command_line_arguments() in tools/benchmark_tool/openvino/tools/benchmark/utils/utils.py, called from main.py after argument parsing. Reproduce both commands from the issue, including a model path containing '=' and an empty -i value. Done means both arguments are collected without a traceback and the -m value retains its full path.

Written by the indexing model from the issue text.

Description

OpenVINO Version

master (786821778a); also reproduces with openvino 2026.3.1 from PyPI

Operating System

Other (Please specify in description)

Device used for inference

CPU

Framework

ONNX

Model used

Not model specific

Issue description

benchmark_app ends in a traceback for two ordinary command lines that argparse has already accepted.

get_command_line_arguments() in tools/benchmark_tool/openvino/tools/benchmark/utils/utils.py is called from main.py on sys.argv right after argument parsing succeeds. It splits on = without a maxsplit and indexes arg[0] without checking for an empty string:

arg_name, arg_value = arg.split('=')   # no maxsplit
...
if arg[0] == '-':                      # unguarded index

A value that itself contains =:

$ benchmark_app -m=/data/exp=1/model.xml
[ ERROR ] too many values to unpack (expected 2)
  File ".../utils/utils.py", line 473, in get_command_line_arguments
    arg_name, arg_value = arg.split('=')
ValueError: too many values to unpack (expected 2)

An empty argument, which is what a shell passes when a variable used for an argument is unset (-i "$INPUT" with INPUT unset):

$ benchmark_app -m model.xml -i ""
[ ERROR ] string index out of range
  File ".../utils/utils.py", line 478, in get_command_line_arguments
    if arg[0] == '-':
IndexError: string index out of range

Neither is rejected by argparse, so the user gets a raw traceback from an internal helper rather than an argument error. The first is reachable from any model path below a directory containing =.

The repro host was Fedora 43 with Python 3.13, though nothing here is OS or model specific: both failures happen while collecting arguments, before any model is read.

Step-by-step reproduction
python3 -m venv venv
./venv/bin/pip install openvino
./venv/bin/benchmark_app -m=/data/exp=1/model.xml
./venv/bin/benchmark_app -m model.xml -i ""
Relevant log output
ValueError: too many values to unpack (expected 2)
IndexError: string index out of range

Expected: the arguments are collected without error, -m keeping the full path as its value.

Issue submission checklist
  • I'm reporting an issue. It's not a question.
  • I checked the problem with the documentation, FAQ, open issues, Stack Overflow, etc., and have not found a solution.
  • There is reproducer code and related data files such as images, videos, models, etc.
Dominant language
C++
Stars
10.9k
Forks
3.4k
Avg merge
4d 1h
Merged PRs (30d)
289

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from openvinotoolkit/openvino

All issues in openvinotoolkit/openvino

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.