File tree Expand file tree Collapse file tree 8 files changed +159
-2
lines changed
cpp/ql/lib/semmle/code/cpp Expand file tree Collapse file tree 8 files changed +159
-2
lines changed Original file line number Diff line number Diff line change
1
+ /**
2
+ * Provides a library for local (intra-procedural) and global (inter-procedural)
3
+ * data flow analysis: deciding whether data can flow from a _source_ to a
4
+ * _sink_. This library differs from the one in `semmle.code.cpp.dataflow` in that
5
+ * this library uses the IR (Intermediate Representation) library, which provides
6
+ * a more precise semantic representation of the program, whereas the other dataflow
7
+ * library uses the more syntax-oriented ASTs. This library should provide more accurate
8
+ * results than the AST-based library in most scenarios.
9
+ *
10
+ * Unless configured otherwise, _flow_ means that the exact value of
11
+ * the source may reach the sink. To track flow where the exact value
12
+ * may not be preserved, import `semmle.code.cpp.dataflow.new.TaintTracking`.
13
+ *
14
+ * To use global (interprocedural) data flow, extend the class
15
+ * `DataFlow::Configuration` as documented on that class. To use local
16
+ * (intraprocedural) data flow between expressions, call
17
+ * `DataFlow::localExprFlow`. For more general cases of local data flow, call
18
+ * `DataFlow::localFlow` or `DataFlow::localFlowStep` with arguments of type
19
+ * `DataFlow::Node`.
20
+ */
21
+
22
+ import cpp
23
+
24
+ /**
25
+ * Provides classes for performing local (intra-procedural) and
26
+ * global (inter-procedural) data flow analyses.
27
+ */
28
+ module DataFlow {
29
+ import semmle.code.cpp.ir.dataflow.internal.DataFlowImpl
30
+ }
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Provides a `DataFlow2` module, which is a copy of the `DataFlow` module. Use
3
+ * this class when data-flow configurations must depend on each other. Two
4
+ * classes extending `DataFlow::Configuration` should never depend on each
5
+ * other, but one of them should instead depend on a
6
+ * `DataFlow2::Configuration`, a `DataFlow3::Configuration`, or a
7
+ * `DataFlow4::Configuration`.
8
+ *
9
+ * See `semmle.code.cpp.dataflow.new.DataFlow` for the full documentation.
10
+ */
11
+
12
+ import cpp
13
+
14
+ /**
15
+ * Provides classes for performing local (intra-procedural) and
16
+ * global (inter-procedural) data flow analyses.
17
+ */
18
+ module DataFlow2 {
19
+ import semmle.code.cpp.ir.dataflow.internal.DataFlowImpl2
20
+ }
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Provides a `DataFlow3` module, which is a copy of the `DataFlow` module. Use
3
+ * this class when data-flow configurations must depend on each other. Two
4
+ * classes extending `DataFlow::Configuration` should never depend on each
5
+ * other, but one of them should instead depend on a
6
+ * `DataFlow2::Configuration`, a `DataFlow3::Configuration`, or a
7
+ * `DataFlow4::Configuration`.
8
+ *
9
+ * See `semmle.code.cpp.dataflow.new.DataFlow` for the full documentation.
10
+ */
11
+
12
+ import cpp
13
+
14
+ /**
15
+ * Provides classes for performing local (intra-procedural) and
16
+ * global (inter-procedural) data flow analyses.
17
+ */
18
+ module DataFlow3 {
19
+ import semmle.code.cpp.ir.dataflow.internal.DataFlowImpl3
20
+ }
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Provides a `DataFlow4` module, which is a copy of the `DataFlow` module. Use
3
+ * this class when data-flow configurations must depend on each other. Two
4
+ * classes extending `DataFlow::Configuration` should never depend on each
5
+ * other, but one of them should instead depend on a
6
+ * `DataFlow2::Configuration`, a `DataFlow3::Configuration`, or a
7
+ * `DataFlow4::Configuration`.
8
+ *
9
+ * See `semmle.code.cpp.dataflow.new.DataFlow` for the full documentation.
10
+ */
11
+
12
+ import cpp
13
+
14
+ /**
15
+ * Provides classes for performing local (intra-procedural) and
16
+ * global (inter-procedural) data flow analyses.
17
+ */
18
+ module DataFlow4 {
19
+ import semmle.code.cpp.ir.dataflow.internal.DataFlowImpl4
20
+ }
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Provides classes for performing local (intra-procedural) and
3
+ * global (inter-procedural) taint-tracking analyses.
4
+ *
5
+ * We define _taint propagation_ informally to mean that a substantial part of
6
+ * the information from the source is preserved at the sink. For example, taint
7
+ * propagates from `x` to `x + 100`, but it does not propagate from `x` to `x >
8
+ * 100` since we consider a single bit of information to be too little.
9
+ *
10
+ * To use global (interprocedural) taint tracking, extend the class
11
+ * `TaintTracking::Configuration` as documented on that class. To use local
12
+ * (intraprocedural) taint tracking between expressions, call
13
+ * `TaintTracking::localExprTaint`. For more general cases of local taint
14
+ * tracking, call `TaintTracking::localTaint` or
15
+ * `TaintTracking::localTaintStep` with arguments of type `DataFlow::Node`.
16
+ */
17
+
18
+ import semmle.code.cpp.ir.dataflow.DataFlow
19
+ import semmle.code.cpp.ir.dataflow.DataFlow2
20
+
21
+ /**
22
+ * Provides classes for performing local (intra-procedural) and
23
+ * global (inter-procedural) taint-tracking analyses.
24
+ */
25
+ module TaintTracking {
26
+ import semmle.code.cpp.ir.dataflow.internal.tainttracking1.TaintTrackingImpl
27
+ }
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Provides a `TaintTracking2` module, which is a copy of the `TaintTracking`
3
+ * module. Use this class when data-flow configurations or taint-tracking
4
+ * configurations must depend on each other. Two classes extending
5
+ * `DataFlow::Configuration` should never depend on each other, but one of them
6
+ * should instead depend on a `DataFlow2::Configuration`, a
7
+ * `DataFlow3::Configuration`, or a `DataFlow4::Configuration`. The
8
+ * `TaintTracking::Configuration` class extends `DataFlow::Configuration`, and
9
+ * `TaintTracking2::Configuration` extends `DataFlow2::Configuration`.
10
+ *
11
+ * See `semmle.code.cpp.dataflow.new.TaintTracking` for the full documentation.
12
+ */
13
+
14
+ /**
15
+ * Provides classes for performing local (intra-procedural) and
16
+ * global (inter-procedural) taint-tracking analyses.
17
+ */
18
+ module TaintTracking2 {
19
+ import semmle.code.cpp.ir.dataflow.internal.tainttracking2.TaintTrackingImpl
20
+ }
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Provides a `TaintTracking3` module, which is a copy of the `TaintTracking`
3
+ * module. Use this class when data-flow configurations or taint-tracking
4
+ * configurations must depend on each other. Two classes extending
5
+ * `DataFlow::Configuration` should never depend on each other, but one of them
6
+ * should instead depend on a `DataFlow2::Configuration`, a
7
+ * `DataFlow3::Configuration`, or a `DataFlow4::Configuration`. The
8
+ * `TaintTracking::Configuration` class extends `DataFlow::Configuration`, and
9
+ * `TaintTracking2::Configuration` extends `DataFlow2::Configuration`.
10
+ *
11
+ * See `semmle.code.cpp.dataflow.new.TaintTracking` for the full documentation.
12
+ */
13
+
14
+ /**
15
+ * Provides classes for performing local (intra-procedural) and
16
+ * global (inter-procedural) taint-tracking analyses.
17
+ */
18
+ module TaintTracking3 {
19
+ import semmle.code.cpp.ir.dataflow.internal.tainttracking3.TaintTrackingImpl
20
+ }
Original file line number Diff line number Diff line change 8
8
* results than the AST-based library in most scenarios.
9
9
*
10
10
* Unless configured otherwise, _flow_ means that the exact value of
11
- * the source may reach the sink. We do not track flow across pointer
12
- * dereferences or array indexing .
11
+ * the source may reach the sink. To track flow where the exact value
12
+ * may not be preserved, import `semmle.code.cpp.ir.dataflow.TaintTracking` .
13
13
*
14
14
* To use global (interprocedural) data flow, extend the class
15
15
* `DataFlow::Configuration` as documented on that class. To use local
You can’t perform that action at this time.
0 commit comments