-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Go: mistyped-exponentiation: notice constants with likely-bitmask values #20523
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
Conversation
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 enhances the mistyped-exponentiation query in Go to better detect XOR operations that might be mistaken for exponentiation by including constants with likely bitmask values in the detection logic.
- Adds support for detecting XOR operations involving declared constants that have hexadecimal or octal initializers
- Updates the test case to include constant declarations with hexadecimal values to verify the enhanced detection
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| go/ql/src/InconsistentCode/MistypedExponentiation.ql | Adds helper function to resolve constant initializers and extends bitmask pattern detection to include constants |
| go/ql/test/query-tests/InconsistentCode/MistypedExponentiation/main.go | Adds test case with hexadecimal constants to verify the enhanced query behavior |
owen-mc
left a comment
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.
Worth a change note?
|
@owen-mc done |
owen-mc
left a comment
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.
Oh wait, this is a quality query. No change note then. Sorry for misinformation earlier.
owen-mc
left a comment
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.
I realised I could delete the change note myself.
No description provided.