-
-
Notifications
You must be signed in to change notification settings - Fork 810
only allow big|small as 2nd arg in search-pattern #1198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
|
Can you try to use the |
|
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. You can reopen it by adding a comment to this issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds validation to the search-pattern command to ensure that when a second argument is provided, it must be either "big" or "little" for endianness specification. Previously, invalid second arguments were silently ignored, leading to confusing behavior.
Key changes:
- Added validation for the second argument to only accept "big" or "little" as valid endianness values
- Returns usage information when an invalid endianness value is provided
- Reformatted the endianness checking code for better readability
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| endian = Endianness.BIG_ENDIAN | ||
| elif argv[1].lower() == "little": | ||
| endian = Endianness.LITTLE_ENDIAN | ||
| else: |
Copilot
AI
Dec 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove trailing whitespace after the colon.
| else: | |
| else: |
| else: | ||
| self.usage() | ||
| return |
Copilot
AI
Dec 28, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new validation logic for the second argument (lines 6182-6184) lacks test coverage. Consider adding a test case that verifies the command shows usage information when an invalid endianness value is provided as the second argument, such as search-pattern PATTERN invalid_value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AAMOF Copilot is right on this.
Can you add a quick test to make there is no regression on this?
| else: | ||
| self.usage() | ||
| return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AAMOF Copilot is right on this.
Can you add a quick test to make there is no regression on this?
Description
What patch does: If not required parameters is passed in
search-patternit will return the usage information.search-pattern PATTERN [little|big] [section]Previously the options are slightly confusing with two optional arguments and no sanitize checks for
big|endianFor example
search-pattern 0x41414141 heapwould be evalutated tosearch-pattern 0x41414141 littleChecklist