Queued
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds two new rule packages (Memory2 and Memory3) to implement MISRA C++ 2023 pointer safety rules RULE-8-7-2 and RULE-8-9-1, which enforce that pointer arithmetic operations (subtraction and relational comparisons) should only be performed on pointers addressing elements of the same array.
Changes:
- Added
Memory2package for RULE-8-7-2 (pointer subtraction validation) - Added
Memory3package for RULE-8-9-1 (pointer relational comparison validation) - Updated rules.csv to assign these new packages to existing rule entries
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| rules.csv | Updated package assignments for RULE-8-7-1, RULE-8-7-2, and RULE-8-9-1 from Memory/uncommitted to Memory1/Memory2/Memory3 |
| rule_packages/cpp/Memory2.json | Added package metadata for RULE-8-7-2 pointer subtraction validation query |
| rule_packages/cpp/Memory3.json | Added package metadata for RULE-8-9-1 pointer comparison validation query |
| cpp/misra/src/rules/RULE-8-7-2/PointerDifferenceTakenBetweenDifferentArrays.ql | Implemented query for detecting pointer subtraction between different arrays |
| cpp/misra/src/rules/RULE-8-9-1/PointerComparedBetweenDifferentArrays.ql | Implemented query for detecting pointer comparisons between different arrays |
| cpp/common/src/codingstandards/cpp/exclusions/cpp/Memory2.qll | Generated metadata for Memory2 package query registration |
| cpp/common/src/codingstandards/cpp/exclusions/cpp/Memory3.qll | Generated metadata for Memory3 package query registration |
| cpp/common/src/codingstandards/cpp/exclusions/cpp/RuleMetadata.qll | Added imports and registrations for Memory2 and Memory3 packages |
| cpp/misra/test/rules/RULE-8-7-2/* | Added test infrastructure files for RULE-8-7-2 |
| cpp/misra/test/rules/RULE-8-9-1/* | Added test infrastructure files for RULE-8-9-1 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cpp/misra/test/rules/RULE-8-9-1/PointerComparedBetweenDifferentArrays.testref
Outdated
Show resolved
Hide resolved
MichaelRFairhurst
requested changes
Feb 3, 2026
Collaborator
MichaelRFairhurst
left a comment
There was a problem hiding this comment.
Nice! Just one metadata comment only
Any commits made after this event will not be merged.
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.
Description
Add
Memory2andMemory3packages.Change request type
.ql,.qll,.qlsor unit tests)Rules with added or modified queries
Release change checklist
A change note (development_handbook.md#change-notes) is required for any pull request which modifies:
If you are only adding new rule queries, a change note is not required.
Author: Is a change note required?
🚨🚨🚨
Reviewer: Confirm that format of shared queries (not the .qll file, the
.ql file that imports it) is valid by running them within VS Code.
Reviewer: Confirm that either a change note is not required or the change note is required and has been added.
Query development review checklist
For PRs that add new queries or modify existing queries, the following checklist should be completed by both the author and reviewer:
Author
As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.
Reviewer
As a rule of thumb, predicates specific to the query should take no more than 1 minute, and for simple queries be under 10 seconds. If this is not the case, this should be highlighted and agreed in the code review process.