Skip to content

Conversation

jketema
Copy link
Collaborator

@jketema jketema commented Aug 21, 2025

Commit-by-commit review recommended.

jketema added 19 commits August 19, 2025 11:26
…taflow library

Note this introduces some new results. This seems to be correct, as before the
update the query seemed to have missed problems with code like the following:
```cpp
void f3(int *v1) {
  int *v2 = v1;
  std::shared_ptr<int> p1(v1);        // NON_COMPLIANT
  new std::shared_ptr<int>(p1.get()); // NON_COMPLIANT
  new std::shared_ptr<int>(v2);       // NON_COMPLIANT
}

void f4() {
  f3(new int(0));
}
```
…w library

Note that this removes - what seems to be - a duplicated test result.
Note that there's a small issue here where the dataflow library causes one of
the results to get duplicated.
Copy link
Contributor

@MathiasVP MathiasVP left a comment

Choose a reason for hiding this comment

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

LGTM!

@jketema jketema marked this pull request as ready for review August 22, 2025 08:10
@Copilot Copilot AI review requested due to automatic review settings August 22, 2025 08:10
@jketema jketema merged commit e293289 into github:next Aug 22, 2025
18 of 21 checks passed
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.

Pull Request Overview

Updates multiple queries to use the new dataflow library by replacing imports from semmle.code.cpp.dataflow.DataFlow and semmle.code.cpp.dataflow.TaintTracking with their new counterparts from semmle.code.cpp.dataflow.new.*. This migration also involves API changes where asDefiningArgument() is replaced with getArgument() and asExpr() is replaced with asIndirectExpr() for certain node types.

  • Migration from old dataflow library to new dataflow library across multiple files
  • API updates for DataFlow nodes including method name changes and flow pattern adjustments
  • Updates to expected test results reflecting changes in dataflow analysis output

Reviewed Changes

Copilot reviewed 34 out of 34 changed files in this pull request and generated 2 comments.

File Description
Multiple .expected files Updated test expectations with new dataflow analysis results showing additional edges and nodes
Multiple .qll files Migrated import statements from old to new dataflow library
Multiple .ql files Updated dataflow API usage with new method names and flow patterns

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

def.asDefiningArgument() = f and
DataFlow::localFlow(def, DataFlow::exprNode(e))
exists(DataFlow::DefinitionByReferenceNode def, DataFlow::Node n |
f.getArgument(0) = def.getArgument() and
Copy link
Preview

Copilot AI Aug 22, 2025

Choose a reason for hiding this comment

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

The API change from asDefiningArgument() to getArgument() may not be semantically equivalent. Consider verifying that def.getArgument() captures the same defining argument semantics as the original def.asDefiningArgument().

Suggested change
f.getArgument(0) = def.getArgument() and
f.getArgument(0) = def.asDefiningArgument() and

Copilot uses AI. Check for mistakes.

exists(DataFlow::DefinitionByReferenceNode def |
exists(DataFlow::DefinitionByReferenceNode def, DataFlow::Node va |
va.asIndirectExpr() = fileAccess.(VariableAccess) and
def.asDefiningArgument() = closedFile and
Copy link
Preview

Copilot AI Aug 22, 2025

Choose a reason for hiding this comment

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

Inconsistent API usage: def.asDefiningArgument() is used here but replaced with def.getArgument() in other files. This should be updated for consistency with the new dataflow library migration.

Suggested change
def.asDefiningArgument() = closedFile and
def.getArgument() = closedFile and

Copilot uses AI. Check for mistakes.

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.

2 participants