Update EXP39-C to use the new dataflow library - #1201
MichaelRFairhurst wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Mandatory QLDoc, line-length, and change-note clarity issues remain.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 3
Open (3)
What changed in this PR
Migrates EXP39-C from the deprecated data-flow library to the new CodeQL data-flow API while preserving reported alerts.
Changes:
- Updates data-flow configuration and sink filtering.
- Refreshes expected path-graph output.
- Adds the required change note.
- Manual VS Code validation remains unconfirmed.
| File | Description |
|---|---|
change_notes/2026-09-20-update-exp39-c-to-use-new-dataflow.md |
Documents the migration. |
c/cert/src/rules/EXP39-C/DoNotAccessVariableViaPointerOfIncompatibleType.ql |
Migrates the query to new data flow. |
c/cert/test/rules/EXP39-C/DoNotAccessVariableViaPointerOfIncompatibleType.expected |
Updates expected paths and locations. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
|
||
| class IndirectCastAnalysisUnconvertedCastExpr extends Expr { | ||
| IndirectCastAnalysisUnconvertedCastExpr() { this = any(Cast c).getUnconverted() } | ||
| class CastedExpr extends Expr { |
| where | ||
| not isExcluded(sink.getNode().asExpr(), | ||
| Pointers3Package::doNotAccessVariableViaPointerOfIncompatibleTypeQuery()) and | ||
| not isExcluded(sinkExpr, Pointers3Package::doNotAccessVariableViaPointerOfIncompatibleTypeQuery()) and |
| - Updated the underlying dataflow library to use the new dataflow from the deprecated old data flow. This may cause behavioral changes in some analyses, usually with improved results and performance. | ||
| - Some refactoring required to accommodate functional changes in how dataflow nodes attach to the AST. No functional changes to the analysis from this are expected. No newline at end of file |
|
/test-performance |
|
🏁 Beep Boop! Performance testing for this PR has been initiated. Please check back later for results. Note that the query package generation step must complete before testing will start so it might be a minute. |
|
🏁 Beep Boop! Performance testing complete! See below for performance of the last 3 runs vs your PR. Times are based on predicate performance. You can find full graphs and stats in the PR that was created for this test in the release engineering repo. 🏁 Below are the slowest predicates for the last 2 releases vs this PR. |

Description
Update EXP39-C to use the new dataflow library.
This query has other issues I decided not to immediately address -- see #1200. The query actually makes all sources sinks in order to report casts from
A*toB*(though this doesn't technically cause UB or violate the rule), only truly requiring dataflow to handle therealloccase.Updating to the new dataflow began reporting both
xand&xin(T*) &x. To continue reporting the issue at the sink, and to excludeT, I check that thenode.asExpr()satisfies the expression's sink conditions, that it's either a cast or a dereference.This query is very slow, partly because its design essentially disables forward/reverse pruning. Roughly timing it on my system indicates that this slowness isn't affected by the dataflow update, so its not something I worried about addressing here.
Change request type
.ql,.qll,.qlsor unit tests)Rules with added or modified queries
EXP39-CRelease 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.