Skip to content

Conversation

@maumaubebe
Copy link

@maumaubebe maumaubebe commented Oct 11, 2025

Description

What patch does: If not required parameters is passed in search-pattern it 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|endian
For example
search-pattern 0x41414141 heap would be evalutated to search-pattern 0x41414141 little

Checklist

  • My code follows the code style of this project.
  • My change includes a change to the documentation, if required.
  • If my change adds new code, adequate tests have been added.
  • I have read and agree to the CONTRIBUTING document.

@github-actions
Copy link

🤖 Coverage update for 6c16e35 🔴

Old New
Commit ee605f9 6c16e35
Score 71.0775% 71.0582% (-0.0193)

@Grazfather
Copy link
Collaborator

Can you try to use the parse_arguments decorator?

@stale
Copy link

stale bot commented Dec 11, 2025

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.

@stale stale bot added the stale label Dec 11, 2025
Copy link

Copilot AI left a 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:
Copy link

Copilot AI Dec 28, 2025

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.

Suggested change
else:
else:

Copilot uses AI. Check for mistakes.
Comment on lines +6182 to +6184
else:
self.usage()
return
Copy link

Copilot AI Dec 28, 2025

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.

Copilot uses AI. Check for mistakes.
Copy link
Owner

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?

Comment on lines +6182 to +6184
else:
self.usage()
return
Copy link
Owner

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?

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.

3 participants