Skip to content

C++: ArrayTypes are never uninitialized - #23255

Merged
jketema merged 4 commits into
github:mainfrom
MathiasVP:fix-uninitialized-array-address
Nov 26, 2026
Merged

jketema merged 4 commits into
github:mainfrom
MathiasVP:fix-uninitialized-array-address

Conversation

@MathiasVP

Copy link
Copy Markdown
Contributor

This PR removes array types from the UninitializedNode class since these values are never uninitialized (what they point to may be uninitialized, but not the arrays themselves).

Commit-by-commit review recommended.

@MathiasVP
MathiasVP requested a review from a team as a code owner November 26, 2026 09:20
Copilot AI adaptive review requested due to automatic review settings November 26, 2026 09:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the array data-flow modeling correction.

No open issues 🎉

What changed in this PR

This PR corrects C++ IR data-flow modeling so array values are not treated as uninitialized, while preserving the distinction between an array’s address and its potentially uninitialized contents.

Changes:

  • Excludes array types from UninitializedNode.
  • Adds regression cases for array and scalar addresses.
  • Updates inline annotations and expected results to reflect the corrected IR behavior.
File Description
cpp/​ql/​test/​library-tests/​dataflow/​dataflow-tests/​uninitialized.expected Adds expected AST results for the new address cases.
cpp/​ql/​test/​library-tests/​dataflow/​dataflow-tests/​test.cpp Adds address regression cases and adjusts inline expectations.
cpp/​ql/​test/​library-tests/​dataflow/​dataflow-tests/​test-source-sink.expected Removes spurious IR array flows and records new AST results.
cpp/​ql/​test/​library-tests/​dataflow/​dataflow-tests/​clang.cpp Updates the array-address annotation to expect AST flow only.
cpp/​ql/​lib/​semmle/​code/​cpp/​ir/​dataflow/​internal/​DataFlowNodes.qll Excludes array types from direct uninitialized nodes.

Review effort: Balanced (adaptive)

@jketema
jketema merged commit 6d6871d into github:main Nov 26, 2026
18 of 19 checks passed
jketema pushed a commit to github/codeql-coding-standards that referenced this pull request Nov 26, 2026
jketema added a commit to github/codeql-coding-standards that referenced this pull request Nov 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants