Skip to content

Commit 9481fc9

Browse files
committed
Add QLDoc explaining reverseRead
1 parent 1d0fcd7 commit 9481fc9

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

shared/dataflow/codeql/dataflow/internal/DataFlowImplConsistency.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,13 @@ module MakeConsistency<
244244

245245
private predicate hasPost(Node n) { exists(PostUpdateNode post | post.getPreUpdateNode() = n) }
246246

247+
/**
248+
* Consider code like `a.b.f = source()`. There is flow from `source()` to
249+
* `[post] a.b` (with an appropriate access path), but we also want there to
250+
* be flow to `[post] a` (with an appropriate access path). The data flow
251+
* library is able to infer this step because there is a read step from `a`
252+
* to `a.b`, as long as the post-update node for `a` exists.
253+
*/
247254
query predicate reverseRead(Node n, string msg) {
248255
exists(Node n2 | readStep(n, _, n2) and hasPost(n2) and not hasPost(n)) and
249256
not Input::reverseReadExclude(n) and

0 commit comments

Comments
 (0)