File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed
cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -215,8 +215,16 @@ predicate addressFlow(Instruction iFrom, Instruction iTo) {
215215 or
216216 iTo .( FieldAddressInstruction ) .getObjectAddress ( ) = iFrom
217217 or
218+ // We traverse `LoadInstruction`s since we want to conclude that the
219+ // destination of the store operation `*x = source()` is derived from `x`.
218220 iTo .( LoadInstruction ) .getSourceAddress ( ) = iFrom
219221 or
222+ // We want to include `ReadSideEffectInstruction`s for the same reason that we include
223+ // `LoadInstruction`s, but only when a `WriteSideEffectInstruction` for the same index exists as well
224+ // (as otherwise we know that the callee won't override the data). However, given an index `i`, the
225+ // destination of the `WriteSideEffectInstruction` for `i` is identical to the source address of the
226+ // `ReadSideEffectInstruction` for `i`. So we don't have to talk about the `ReadSideEffectInstruction`
227+ // at all.
220228 exists ( WriteSideEffectInstruction write |
221229 write .getPrimaryInstruction ( ) = iTo and
222230 write .getDestinationAddress ( ) = iFrom
You can’t perform that action at this time.
0 commit comments