Skip to content

Commit c90fa1b

Browse files
author
Dave Bartolomeo
authored
Merge pull request #2255 from jbj/localInstructionFlow
C++: localInstruction{Flow,Taint} helpers
2 parents 1fe5a9e + df2fbfb commit c90fa1b

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowUtil.qll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,14 @@ private predicate simpleInstructionLocalFlowStep(Instruction iFrom, Instruction
214214
*/
215215
predicate localFlow(Node source, Node sink) { localFlowStep*(source, sink) }
216216

217+
/**
218+
* Holds if data can flow from `i1` to `i2` in zero or more
219+
* local (intra-procedural) steps.
220+
*/
221+
predicate localInstructionFlow(Instruction e1, Instruction e2) {
222+
localFlow(instructionNode(e1), instructionNode(e2))
223+
}
224+
217225
/**
218226
* Holds if data can flow from `e1` to `e2` in zero or more
219227
* local (intra-procedural) steps.

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/TaintTrackingUtil.qll

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,14 @@ private predicate localInstructionTaintStep(Instruction nodeFrom, Instruction no
5353
*/
5454
predicate localTaint(DataFlow::Node source, DataFlow::Node sink) { localTaintStep*(source, sink) }
5555

56+
/**
57+
* Holds if taint can flow from `i1` to `i2` in zero or more
58+
* local (intra-procedural) steps.
59+
*/
60+
predicate localInstructionTaint(Instruction i1, Instruction i2) {
61+
localTaint(DataFlow::instructionNode(i1), DataFlow::instructionNode(i2))
62+
}
63+
5664
/**
5765
* Holds if taint can flow from `e1` to `e2` in zero or more
5866
* local (intra-procedural) steps.

0 commit comments

Comments
 (0)