Repository navigation
fix(cli): validate numeric arguments without truncation - #346
Open
blackdragoon26 wants to merge 4 commits into
Open
blackdragoon26 wants to merge 4 commits into
blackdragoon26 wants to merge 4 commits into
Conversation
7 of 13 tasks
Signed-off-by: blackdragoon26 <sankalp.jha9643@gmail.com>
Collaborator
|
Thanks! LGTM, and should we reject extreme small sample ratio? |
Signed-off-by: blackdragoon26 <sankalp.jha9643@gmail.com>
Author
Thank you for catching this! Added the lower-bound check and boundary tests in ecbcfcf. |
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 and Ubuntu x86_64 with a Release build and LeakSanitizer. All 10 CTest targets pass. The latest macOS run includes 262 CLI checks, all passing.
Formatting, shell syntax and whitespace checks pass. The existing macOS 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)