The Wayback Machine - https://web.archive.org/web/20251226191450/https://github.com/github/codeql/pull/4468
Skip to content

Conversation

@rdmarsh2
Copy link
Contributor

This PR adds general flow through operator* in AddressFlow.qll and FlowVar.qll, and adds iterator-specific flow through operator= in DataFlowUtil.qll. Those combine to support flow through iterators returned by the std::back_inserter function.

A few existing tests are affected by the operator* changes. I think those are mostly positive.

@rdmarsh2 rdmarsh2 requested a review from a team as a code owner October 13, 2020 23:32
@rdmarsh2 rdmarsh2 added the C++ label Oct 13, 2020
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 apart from a few small comments!

Copy link
Contributor

@jbj jbj left a comment

Choose a reason for hiding this comment

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

Otherwise LGTM

Comment on lines 302 to 303
this.hasName(["front_inserter", "inserter", "back_inserter"]) and
this.getNamespace().hasName("std")
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use hasQualifiedName("std", [...])?

Comment on lines +413 to +414
*i14++ = source();
sink(v14); // tainted [NOT DETECTED by IR]
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd like to see some prefix-++ and some -- too.

@rdmarsh2
Copy link
Contributor Author

I've rewritten most of the QL changes. It now works with just the previously existing nodes and some additional flow edges to the return value input for operator* and operator=.

Copy link
Contributor

@jbj jbj left a comment

Choose a reason for hiding this comment

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

Thanks for making these changes! The code looks much better now that the library-specific details have been moved into the model classes. I have a few more review comments.

jbj
jbj previously approved these changes Oct 20, 2020
Copy link
Contributor

@jbj jbj left a comment

Choose a reason for hiding this comment

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

This PR LGTM with the latest round of changes. The test failures are caused by semantic merge conflicts with #4471.

Accept test changes for unnamed elements
jbj
jbj previously approved these changes Oct 21, 2020
@jbj
Copy link
Contributor

jbj commented Oct 21, 2020

I've started https://jenkins.internal.semmle.com/job/Changes/job/CPP-Differences/1511/. Feel free to self-merge if there are no performance or result regressions.

@jbj
Copy link
Contributor

jbj commented Oct 22, 2020

@rdmarsh2 The slowdowns on Linux and Kamailio are too big to ignore, so please investigate. They occur in queries that don't use data flow, so perhaps they're inside the models library.

Copy link
Contributor

@jbj jbj left a comment

Choose a reason for hiding this comment

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

The re-run of CPP-Differences doesn't have the same performance outliers, so perhaps it was just noise.

@jbj jbj merged commit 8f6dbe9 into main Oct 27, 2020
@rdmarsh2 rdmarsh2 deleted the rdmarsh2/cpp/output-iterators-2 branch February 15, 2022 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants