File tree Expand file tree Collapse file tree 2 files changed +4
-22
lines changed
cpp/ql/test/library-tests/dataflow/dataflow-tests Expand file tree Collapse file tree 2 files changed +4
-22
lines changed Original file line number Diff line number Diff line change @@ -329,21 +329,21 @@ namespace NestedTests {
329
329
namespace FlowThroughGlobals {
330
330
int globalVar;
331
331
332
- int taintGlobal () {
332
+ void taintGlobal () {
333
333
globalVar = source ();
334
334
}
335
335
336
- int f () {
336
+ void f () {
337
337
sink (globalVar); // $ ir=333:17 ir=347:17 // tainted or clean? Not sure.
338
338
taintGlobal ();
339
339
sink (globalVar); // $ ir=333:17 ir=347:17 MISSING: ast
340
340
}
341
341
342
- int calledAfterTaint () {
342
+ void calledAfterTaint () {
343
343
sink (globalVar); // $ ir=333:17 ir=347:17 MISSING: ast
344
344
}
345
345
346
- int taintAndCall () {
346
+ void taintAndCall () {
347
347
globalVar = source ();
348
348
calledAfterTaint ();
349
349
sink (globalVar); // $ ast ir=333:17 ir=347:17
Original file line number Diff line number Diff line change @@ -77,27 +77,9 @@ module IRTest {
77
77
)
78
78
}
79
79
80
- override predicate isAdditionalFlowStep ( DataFlow:: Node n1 , DataFlow:: Node n2 ) {
81
- exists ( GlobalOrNamespaceVariable var | var .getName ( ) .matches ( "flowTestGlobal%" ) |
82
- writesVariable ( n1 .asInstruction ( ) , var ) and
83
- var = n2 .asVariable ( )
84
- or
85
- readsVariable ( n2 .asInstruction ( ) , var ) and
86
- var = n1 .asVariable ( )
87
- )
88
- }
89
-
90
80
override predicate isBarrier ( DataFlow:: Node barrier ) {
91
81
barrier .asExpr ( ) .( VariableAccess ) .getTarget ( ) .hasName ( "barrier" ) or
92
82
barrier = DataFlow:: InstructionBarrierGuard< testBarrierGuard / 3 > :: getABarrierNode ( )
93
83
}
94
84
}
95
-
96
- private predicate readsVariable ( LoadInstruction load , Variable var ) {
97
- load .getSourceAddress ( ) .( VariableAddressInstruction ) .getAstVariable ( ) = var
98
- }
99
-
100
- private predicate writesVariable ( StoreInstruction store , Variable var ) {
101
- store .getDestinationAddress ( ) .( VariableAddressInstruction ) .getAstVariable ( ) = var
102
- }
103
85
}
You can’t perform that action at this time.
0 commit comments