C++: Iterator derefs are partial writes - #18674
Draft
MathiasVP wants to merge 1 commit into
Draft
Conversation
Contributor
There was a problem hiding this comment.
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Tip: Copilot code review supports C#, Go, Java, JavaScript, Markdown, Python, Ruby and TypeScript, with more languages coming soon. Learn more
Contributor
Author
|
Hm. The DCA results looks funny. It seems like we have no changes in the number of results, but |
jketema
marked this pull request as draft
February 20, 2025 15:52
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.
In #15633 we started to interpret flow out of a non-MaD dataflow/taint-flow model (i.e., a class that extends DataFlowFunction or TaintFlowFunction) as totally overwriting the destination buffer.
Obviously, since not all functions overwrite the entire destination buffer, we had to come up with a way to opt out of this now-default behavior. So we added an
isPartialWritepredicate that could be overwritten on classes that did not overwrite the entire buffer. In #15633 I went through most of our classes to add this, but I see that I missed theoperator*functions in iterators.Why do
operator*even have flow out, you may ask? That's a good question! It stems from a pretty neat idea we had back in the days of AST dataflow that we could provide flow fromsource()tomyIteratorin:(which would then have another step to its underlying container) by adding a dataflow model for
operator*from the return value to the qualifier. That is, the opposite direction of what you'd normally add for flow out ofoperator*(the same idea is used in dataflow)The end result is that
operator*actually does "write" to its qualifier, and this write is obviously not meant to totally overwrite the qualifier.For various reasons, it's not actually possible to observe any missing flow because of this, but I'm currently working on another PR where this matters.