Repository navigation
fix(cli): validate numeric arguments without truncation - #346
Open
blackdragoon26 wants to merge 1 commit into
Open
blackdragoon26 wants to merge 1 commit into
blackdragoon26 wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fixes numeric option parsing in
cachesim. Malformed values such as--hashpower=8junkand--sample-ratio=nannow produce an error instead of silently changing simulation settings.Request limits are parsed as 64-bit integers, so
--num-req=4294967306no longer becomes 10. Existing supported values, including--num-req=-1, are preserved.Related to #206.
Type of change
How was it tested?
Tested on macOS with a Debug build. All 10 CTest targets pass with
ctest --test-dir _build_dbg --output-on-failure --parallel 4, including all 260 CLI checks.The 56 new numeric checks produce 36 failures with the original parser and none with this fix. Formatting, shell syntax, and whitespace checks pass.
Linux was not tested locally. The existing warning in
libCacheSim/bin/debug/main.cppremains.ctest --test-dir _build --output-on-failurepasses, tested using_build_dbg-Wall -Wextra -Werror)Results
Invalid numeric arguments are rejected with a clear error. Large request limits retain their full value, and valid inputs continue to work.
Checklist
clang-format(or the pre-commit hook fromscripts/setup_hooks.sh)