-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
C++: Remove pointer/pointee conflation from models of "pure" functions #18556
C++: Remove pointer/pointee conflation from models of "pure" functions #18556
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again, by re-requesting a review.
@@ -26,22 +27,43 @@ private class PureStrFunction extends AliasFunction, ArrayFunction, TaintFunctio | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add a helper predicate for the locale argument check?
/** Holds if `i` is a locale parameter that does not carry taint. */ | |
private predicate isLocaleParameter(ParameterIndex i) { | |
this.getName().matches("%\\_l") and i + 1 = this.getNumberOfParameters() | |
} | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea! Fixed in 7792839
// indirection of the parameter. Otherwise, there is taint from the | ||
// parameter. | ||
// 2. If the return value is of a pointer type then there is taint to the | ||
// indirection of the return. Otherwise, there is taint to the return. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to move this comment up before the exists
given that it concerns both the stuff inside the exists
and also the conjunct after it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. Fixed in 67e3b69
Co-authored-by: Simon Friis Vindum <[email protected]>
Co-authored-by: Simon Friis Vindum <[email protected]>
Thanks for the review, @paldepind! I believe I've resolved all your comments now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great to me 👍
This PR cleans up the taint-flow model for the
PureStrFunction
class. Previously, this was conflating pointers and their indirections which caused false flow in some cases. See the first commit for an example of this.Additionally, I added a dataflow model for the cases where the pointer is actually preserved.
DCA shows 3 lost results, and they appear to be FPs that are now correctly removed.