Skip to content

Commit d62e3f6

Browse files
authored
Merge pull request github#11137 from jketema/dataflow-test-fixes
C++: Small fixes for the dataflow tests
2 parents 99ca28e + 291027a commit d62e3f6

File tree

2 files changed

+4
-22
lines changed

2 files changed

+4
-22
lines changed

cpp/ql/test/library-tests/dataflow/dataflow-tests/test.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -329,21 +329,21 @@ namespace NestedTests {
329329
namespace FlowThroughGlobals {
330330
int globalVar;
331331

332-
int taintGlobal() {
332+
void taintGlobal() {
333333
globalVar = source();
334334
}
335335

336-
int f() {
336+
void f() {
337337
sink(globalVar); // $ ir=333:17 ir=347:17 // tainted or clean? Not sure.
338338
taintGlobal();
339339
sink(globalVar); // $ ir=333:17 ir=347:17 MISSING: ast
340340
}
341341

342-
int calledAfterTaint() {
342+
void calledAfterTaint() {
343343
sink(globalVar); // $ ir=333:17 ir=347:17 MISSING: ast
344344
}
345345

346-
int taintAndCall() {
346+
void taintAndCall() {
347347
globalVar = source();
348348
calledAfterTaint();
349349
sink(globalVar); // $ ast ir=333:17 ir=347:17

cpp/ql/test/library-tests/dataflow/dataflow-tests/test.ql

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,9 @@ module IRTest {
7777
)
7878
}
7979

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-
9080
override predicate isBarrier(DataFlow::Node barrier) {
9181
barrier.asExpr().(VariableAccess).getTarget().hasName("barrier") or
9282
barrier = DataFlow::InstructionBarrierGuard<testBarrierGuard/3>::getABarrierNode()
9383
}
9484
}
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-
}
10385
}

0 commit comments

Comments
 (0)