Skip to content

Michaelrfairhurst/package undefined behavior mismatched list delete#1098

Open
MichaelRFairhurst wants to merge 10 commits intomichaelrfairhurst/package-undefined-behaviorfrom
michaelrfairhurst/package-undefined-behavior-mismatched-list-delete
Open

Michaelrfairhurst/package undefined behavior mismatched list delete#1098
MichaelRFairhurst wants to merge 10 commits intomichaelrfairhurst/package-undefined-behaviorfrom
michaelrfairhurst/package-undefined-behavior-mismatched-list-delete

Conversation

@MichaelRFairhurst
Copy link
Copy Markdown
Collaborator

Description

please enter the description of your change here

Change request type

  • Release or process automation (GitHub workflows, internal scripts)
  • Internal documentation
  • External documentation
  • Query files (.ql, .qll, .qls or unit tests)
  • External scripts (analysis report or other code shipped as part of a release)

Rules with added or modified queries

  • No rules added
  • Queries have been added for the following rules:
    • RULE-4-1-3
  • Queries have been modified for the following rules:
    • EXP51-CPP

Release change checklist

A change note (development_handbook.md#change-notes) is required for any pull request which modifies:

  • The structure or layout of the release artifacts.
  • The evaluation performance (memory, execution time) of an existing query.
  • The results of an existing query in any circumstance.

If you are only adding new rule queries, a change note is not required.

Author: Is a change note required?

  • Yes
  • No

🚨🚨🚨
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.

  • Confirmed

Reviewer: Confirm that either a change note is not required or the change note is required and has been added.

  • Confirmed

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

  • Have all the relevant rule package description files been checked in?
  • Have you verified that the metadata properties of each new query is set appropriately?
  • Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
  • Are the alert messages properly formatted and consistent with the style guide?
  • Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
    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.
  • Does the query have an appropriate level of in-query comments/documentation?
  • Have you considered/identified possible edge cases?
  • Does the query not reinvent features in the standard library?
  • Can the query be simplified further (not golfed!)

Reviewer

  • Have all the relevant rule package description files been checked in?
  • Have you verified that the metadata properties of each new query is set appropriately?
  • Do all the unit tests contain both "COMPLIANT" and "NON_COMPLIANT" cases?
  • Are the alert messages properly formatted and consistent with the style guide?
  • Have you run the queries on OpenPilot and verified that the performance and results are acceptable?
    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.
  • Does the query have an appropriate level of in-query comments/documentation?
  • Have you considered/identified possible edge cases?
  • Does the query not reinvent features in the standard library?
  • Can the query be simplified further (not golfed!)

MichaelRFairhurst and others added 7 commits March 13, 2026 18:43
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…aelrfairhurst/package-undefined-behavior-mismatched-list-delete
…ned-behavior' into michaelrfairhurst/package-undefined-behavior-mismatched-list-delete
Copilot AI review requested due to automatic review settings March 30, 2026 23:59
…ned-behavior' into michaelrfairhurst/package-undefined-behavior-mismatched-list-delete
This reverts commit 9d539a3.

The commit itself is good, but it should not be done in this branch.
Copy link
Copy Markdown
Contributor

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

Adds new MISRA C++ 2023 rule query wrappers and supporting libraries, refactors existing CERT query logic into a shared implementation for reuse, and expands uninitialized-memory detection/testing across packs.

Changes:

  • Added MISRA queries for RULE-4-1-3, RULE-11-6-2, RULE-13-3-3, and RULE-22-3-1 with new rule-package JSON entries and test coverage.
  • Refactored EXP51-CPP “array delete type mismatch” into a shared .qll and reused it from both CERT and MISRA.
  • Enhanced the uninitialized-memory shared logic/tests and introduced a C/C++ assert-macro modeling library (plus new qtil dependency and version bumps).

Reviewed changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
rules.csv Update supported rules mapping
rule_packages/cpp/Undefined.json Add RULE-4-1-3 query metadata
rule_packages/cpp/Preconditions3.json New package for RULE-22-3-1
rule_packages/cpp/Lifetime.json New package for lifetime rules
rule_packages/cpp/Freed.json Add shared implementation pointer
rule_packages/cpp/Declarations1.json New package for RULE-13-3-3
docs/user_manual.md Bump documented release version
cpp/report/src/qlpack.yml Bump pack version
cpp/misra/test/rules/RULE-6-8-3/AutomaticStorageAssignedToObjectGreaterLifetime.testref Point to shared test query
cpp/misra/test/rules/RULE-4-1-3/ArrayDeletedThroughPointerOfIncorrectType.testref Add test reference
cpp/misra/test/rules/RULE-22-3-1/test.cpp New test cases
cpp/misra/test/rules/RULE-22-3-1/AssertMacroUsedWithAConstantExpression.qlref New test query ref
cpp/misra/test/rules/RULE-22-3-1/AssertMacroUsedWithAConstantExpression.expected New expected results
cpp/misra/test/rules/RULE-13-3-3/functions2.cpp New test cases
cpp/misra/test/rules/RULE-13-3-3/functions1.cpp New test cases
cpp/misra/test/rules/RULE-13-3-3/DeclarationsOfAFunctionSameParameterName.qlref New test query ref
cpp/misra/test/rules/RULE-13-3-3/DeclarationsOfAFunctionSameParameterName.expected New expected results
cpp/misra/test/rules/RULE-11-6-2/ValueOfAnObjectMustNotBeReadBeforeItHasBeenSet.testref Add test reference
cpp/misra/test/qlpack.yml Bump test pack version
cpp/misra/src/rules/RULE-6-8-3/AutomaticStorageAssignedToObjectGreaterLifetime.ql New MISRA wrapper query
cpp/misra/src/rules/RULE-4-1-3/ArrayDeletedThroughPointerOfIncorrectType.ql New MISRA wrapper query
cpp/misra/src/rules/RULE-22-3-1/AssertMacroUsedWithAConstantExpression.ql New MISRA query implementation
cpp/misra/src/rules/RULE-13-3-3/DeclarationsOfAFunctionSameParameterName.ql New MISRA query implementation
cpp/misra/src/rules/RULE-11-6-2/ValueOfAnObjectMustNotBeReadBeforeItHasBeenSet.ql New MISRA wrapper query
cpp/misra/src/qlpack.yml Bump pack version
cpp/common/test/rules/readofuninitializedmemory/test.cpp Add extra test coverage
cpp/common/test/rules/readofuninitializedmemory/ReadOfUninitializedMemory.expected Update expected results
cpp/common/test/rules/possibledataracebetweenthreadsshared/test.cpp Fix/expand test calls
cpp/common/test/rules/possibledataracebetweenthreadsshared/PossibleDataRaceBetweenThreadsShared.expected Update expected results
cpp/common/test/rules/donotdeleteanarraythroughapointeroftheincorrecttypeshared/test.cpp Formatting-only tweak
cpp/common/test/rules/donotdeleteanarraythroughapointeroftheincorrecttypeshared/DoNotDeleteAnArrayThroughAPointerOfTheIncorrectTypeShared.ql Add generated test query
cpp/common/test/rules/donotdeleteanarraythroughapointeroftheincorrecttypeshared/DoNotDeleteAnArrayThroughAPointerOfTheIncorrectTypeShared.expected New expected output
cpp/common/test/rules/donotcopyaddressofautostorageobjecttootherobject/test.cpp Add extra test cases
cpp/common/test/rules/donotcopyaddressofautostorageobjecttootherobject/DoNotCopyAddressOfAutoStorageObjectToOtherObject.expected Update expected results
cpp/common/test/qlpack.yml Bump test pack version
cpp/common/test/library/codingstandards/cpp/standardlibrary/Assert/test.cpp New assert-macro test stubs
cpp/common/test/library/codingstandards/cpp/standardlibrary/Assert/AssertTest.ql Add inline expectations test
cpp/common/test/library/codingstandards/cpp/standardlibrary/Assert/AssertTest.expected Expected file placeholder
cpp/common/test/includes/standard-library/assert.h Improve assert stub behavior
cpp/common/test/codeql-pack.lock.yml Add qtil lock dependency
cpp/common/src/qlpack.yml Add qtil dependency + bump
cpp/common/src/codingstandards/cpp/standardlibrary/Assert.qll New assert modeling library
cpp/common/src/codingstandards/cpp/rules/readofuninitializedmemory/ReadOfUninitializedMemory.qll Improve initialization modeling
cpp/common/src/codingstandards/cpp/rules/readofuninitializedmemory/InitializationFunctions.qll Add init-function library copy
cpp/common/src/codingstandards/cpp/rules/possibledataracebetweenthreadsshared/PossibleDataRaceBetweenThreadsShared.qll Fix non-reentrant name list
cpp/common/src/codingstandards/cpp/rules/donotdeleteanarraythroughapointeroftheincorrecttypeshared/DoNotDeleteAnArrayThroughAPointerOfTheIncorrectTypeShared.qll New shared path query
cpp/common/src/codingstandards/cpp/lifetimes/CppObjects.qll Treat new as allocation identity
cpp/common/src/codingstandards/cpp/exclusions/cpp/Undefined.qll Register new undefined query
cpp/common/src/codingstandards/cpp/exclusions/cpp/RuleMetadata.qll Import new packages
cpp/common/src/codingstandards/cpp/exclusions/cpp/Preconditions3.qll New autogenerated exclusions
cpp/common/src/codingstandards/cpp/exclusions/cpp/Lifetime.qll New autogenerated exclusions
cpp/common/src/codingstandards/cpp/exclusions/cpp/Declarations1.qll New autogenerated exclusions
cpp/common/src/codingstandards/cpp/ast/Search.qll New AST search helper
cpp/common/src/codingstandards/cpp/ast/Conditions.qll New Conditional abstraction
cpp/common/src/codeql-pack.lock.yml Add qtil lock dependency
cpp/cert/test/rules/EXP51-CPP/DoNotDeleteAnArrayThroughAPointerOfTheIncorrectType.testref Point CERT test to shared
cpp/cert/test/rules/EXP51-CPP/DoNotDeleteAnArrayThroughAPointerOfTheIncorrectType.qlref Remove direct qlref
cpp/cert/test/rules/EXP51-CPP/DoNotDeleteAnArrayThroughAPointerOfTheIncorrectType.expected Remove old expected output
cpp/cert/test/qlpack.yml Bump test pack version
cpp/cert/test/codeql-pack.lock.yml Add qtil lock dependency
cpp/cert/src/rules/EXP51-CPP/DoNotDeleteAnArrayThroughAPointerOfTheIncorrectType.ql Use shared implementation
cpp/cert/src/qlpack.yml Bump pack version
cpp/cert/src/codeql-pack.lock.yml Add qtil lock dependency
cpp/autosar/test/qlpack.yml Bump test pack version
cpp/autosar/test/codeql-pack.lock.yml Add qtil lock dependency
cpp/autosar/src/qlpack.yml Bump pack version
cpp/autosar/src/codeql-pack.lock.yml Add qtil lock dependency
change_notes/2026-03-13-share-array-delete-type-mismatch-query.md Change note for refactor
change_notes/2026-02-03-uninitialized-mem-improve.md Change note for init tracking
c/misra/test/qlpack.yml Bump test pack version
c/misra/test/codeql-pack.lock.yml Add qtil lock dependency
c/misra/src/qlpack.yml Bump pack version
c/misra/src/codeql-pack.lock.yml Add qtil lock dependency
c/common/test/rules/possibledataracebetweenthreadsshared/PossibleDataRaceBetweenThreadsShared.expected Update expected results
c/common/test/qlpack.yml Bump test pack version
c/common/test/codeql-pack.lock.yml Add qtil lock dependency
c/common/src/qlpack.yml Bump pack version
c/common/src/codeql-pack.lock.yml Add qtil lock dependency
c/cert/test/qlpack.yml Bump test pack version
c/cert/test/codeql-pack.lock.yml Add qtil lock dependency
c/cert/src/qlpack.yml Bump pack version
c/cert/src/codeql-pack.lock.yml Add qtil lock dependency
.vscode/tasks.json Add Lifetime task group
.github/workflows/verify-standard-library-dependencies.yml Bump checkout action
.github/workflows/validate-release.yml Bump token action
.github/workflows/validate-query-test-case-formatting.yml Update triggers + checkout
.github/workflows/validate-query-help.yml Update triggers + checkout
.github/workflows/validate-query-formatting.yml Update triggers + checkout
.github/workflows/validate-package-files.yml Update triggers + checkout
.github/workflows/upgrade_codeql_dependencies.yml Bump checkout action
.github/workflows/update-release.yml Bump token action
.github/workflows/tooling-unit-tests.yml Update triggers + checkout
.github/workflows/standard_library_upgrade_tests.yml Bump checkout action
.github/workflows/prepare-release.yml Bump actions versions
.github/workflows/generate-html-docs.yml Bump checkout action
.github/workflows/finalize-release.yml Bump actions versions
.github/workflows/extra-rule-validation.yml Update triggers + checkout
.github/workflows/dispatch-release-performance-check.yml Bump actions versions
.github/workflows/dispatch-matrix-test-on-comment.yml Bump actions versions
.github/workflows/codeql_unit_tests.yml Update triggers + checkout
.github/workflows/code-scanning-pack-gen.yml Bump checkout action
.github/copilot-instructions.md Extend review guidance

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