Skip to content

Commit fd757b0

Browse files
yoffRasmusWL
andcommitted
Update python/ql/lib/semmle/python/dataflow/new/internal/DataFlowPrivate.qll
Co-authored-by: Rasmus Wriedt Larsen <[email protected]>
1 parent 58bf70d commit fd757b0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

python/ql/lib/semmle/python/dataflow/new/internal/DataFlowPrivate.qll

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -389,9 +389,10 @@ module LocalFlow {
389389
or
390390
IncludePostUpdateFlow<PhaseDependentFlow<expressionFlowStep/2>::step/2>::step(nodeFrom, nodeTo)
391391
or
392-
// Use-use flow can generate self loops. We want to filter steps from `n` to `n`
393-
// after we have included steps from `[post] n` to `n`, so after
394-
// `IncludePostUpdateFlow` has ben applied.
392+
// Blindly applying use-use flow can result in a node that steps to itself, for
393+
// example in while-loops. To uphold dataflow consistency checks, we don't want
394+
// that. However, we do want to allow `[post] n` to `n` (to handle while loops), so
395+
// we should only do the filtering after `IncludePostUpdateFlow` has ben applied.
395396
IncludePostUpdateFlow<PhaseDependentFlow<useUseFlowStep/2>::step/2>::step(nodeFrom, nodeTo) and
396397
nodeFrom != nodeTo
397398
}

0 commit comments

Comments
 (0)