Skip to content

Check for missing thread count argument for -s/--threads#3940

Merged
paulromano merged 1 commit into
openmc-dev:developfrom
charliesheh:fix-source-strength-range-check
May 18, 2026
Merged

Check for missing thread count argument for -s/--threads#3940
paulromano merged 1 commit into
openmc-dev:developfrom
charliesheh:fix-source-strength-range-check

Conversation

@charliesheh
Copy link
Copy Markdown
Contributor

Summary
Adds validation for the -s / --threads command line option to ensure a thread count argument is provided before accessing argv[i].

Previously, invoking:
openmc -s
could result in an out-of-range access and exception rather than returning a clean invalid argument error.

Changes Made

  • Added argument existence check before reading thread count value
  • Returns OPENMC_E_INVALID_ARGUMENT with a descriptive error message when no thread count is specified

Issue
Fixes #3353

Copy link
Copy Markdown
Contributor

@paulromano paulromano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @charliesheh!

@paulromano paulromano merged commit beed56e into openmc-dev:develop May 18, 2026
17 checks passed
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.

-s command line option is not range checked

2 participants