Skip to content

Commit bd2ecd3

Browse files
committed
C++: Add test.
1 parent 2075716 commit bd2ecd3

File tree

1 file changed

+18
-0
lines changed
  • cpp/ql/test/library-tests/dataflow/taint-tests

1 file changed

+18
-0
lines changed

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,24 @@ module AstTest {
7676
module IRTest {
7777
private import semmle.code.cpp.ir.IR
7878
private import semmle.code.cpp.ir.dataflow.TaintTracking
79+
private import semmle.code.cpp.ir.dataflow.FlowSteps
80+
81+
/**
82+
* Object->field flow when the object is of type
83+
* TaintInheritingContentObject and the field is named
84+
* flowFromObject
85+
*/
86+
class TaintInheritingContentTest extends TaintInheritingContent, DataFlow::FieldContent {
87+
TaintInheritingContentTest() {
88+
exists(Struct o, Field f |
89+
this.getField() = f and
90+
f = o.getAField() and
91+
o.hasGlobalName("TaintInheritingContentObject") and
92+
f.hasName("flowFromObject") and
93+
this.getIndirectionIndex() = 1
94+
)
95+
}
96+
}
7997

8098
/** Common data flow configuration to be used by tests. */
8199
module TestAllocationConfig implements DataFlow::ConfigSig {

0 commit comments

Comments
 (0)