Skip to content

C++: Remove FPs in cpp/wrong-type-format-argument caused by no linker awareness #18613

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Feb 3, 2025

Conversation

calumgrant
Copy link
Contributor

@calumgrant calumgrant commented Jan 28, 2025

This PR addresses the largest source of false-positives on QA whereby a project was built with two versions of the same printf-style function taking different arguments. Without linker awareness, these functions were becoming confused.

My initial attempt to fix this involved looking at whether the function was defined differently, but this ran into the issue that there can be multiple versions of char* in the database, so instead I changed the check to ensure that the format argument is always in the same position. In the QA project qhull, the results went down from 985 to 4. Unfortunately is also loses a few TPs in the process but I don't think there is an easy way to fix this at the moment.

Pull Request checklist

All query authors

Internal query authors only

  • Autofixes generated based on these changes are valid, only needed if this PR makes significant changes to .ql, .qll, or .qhelp files. See the documentation (internal access required).
  • Changes are validated at scale (internal access required).
  • Adding a new query? Consider also adding the query to autofix.

@github-actions github-actions bot added the C++ label Jan 28, 2025
@calumgrant calumgrant marked this pull request as ready for review January 29, 2025 18:03
@Copilot Copilot AI review requested due to automatic review settings January 29, 2025 18:03
@calumgrant calumgrant requested a review from a team as a code owner January 29, 2025 18:03
Copy link
Contributor

@Copilot 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.

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

Tip: Copilot only keeps its highest confidence comments to reduce noise and keep you focused. Learn more

jketema
jketema previously approved these changes Jan 30, 2025
Copy link
Contributor

@jketema jketema left a comment

Choose a reason for hiding this comment

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

LGTM. Might need a change note?

@calumgrant calumgrant merged commit ed3ad1a into main Feb 3, 2025
13 of 14 checks passed
@calumgrant calumgrant deleted the calumgrant/bmn/wrong-type-format-arg-linkage branch February 3, 2025 10:39
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.

2 participants