C++: Fix a crazy FP in cpp/leap-year/unsafe-array-for-days-of-the-year - #22460
Merged
Conversation
…ar/unsafe-array-for-days-of-the-year'.
Contributor
There was a problem hiding this comment.
Copilot review overview
Review tier: Balanced
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
cpp/ql/test/query-tests/Likely Bugs/Leap Year/UnsafeArrayForDaysOfYear/test.cpp — This sentence is grammatically incomplete (which has no verb), and the following clause… |
What changed in this PR
Prevents false positives caused by compiler-generated 365-character arrays such as __PRETTY_FUNCTION__.
Changes:
- Excludes compiler-generated variables from the query.
- Adds a focused regression case.
| File | Description |
|---|---|
cpp/ql/src/Likely Bugs/Leap Year/UnsafeArrayForDaysOfYear.ql |
Filters compiler-generated variables. |
cpp/ql/test/query-tests/Likely Bugs/Leap Year/UnsafeArrayForDaysOfYear/test.cpp |
Tests the __PRETTY_FUNCTION__ false positive. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
jketema
approved these changes
Aug 28, 2026
Contributor
Author
|
Integration failures are unrelated. Merging! |
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.

This is from an internal FP report at Microsoft. It is without a single level of doubt my favorite false positive in CodeQL ever. And I'm kinda excited that I get to share it with you all since it happened in a GitHub query 😂