Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 833165f

Browse files
committed
C++: Update the (synthetic) test.
1 parent c85262c commit 833165f

3 files changed

Lines changed: 17 additions & 19 deletions

File tree

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
WARNING: This QLDoc comment is not attached to any QL element (taint.ql:5,1-7,4)
2-
WARNING: This QLDoc comment is not attached to any QL element (taint.ql:29,1-31,4)
31
testFailures
42
failures

cpp/ql/test/library-tests/dataflow/models-as-data/taint.ql

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import semmle.code.cpp.security.FlowSources
55
/**
66
* Models-as-data source models for this test.
77
*/
8-
/*private class TestSources extends SourceModelCsv {
8+
private class TestSources extends SourceModelCsv {
99
override predicate row(string row) {
1010
row =
1111
[
@@ -24,12 +24,12 @@ import semmle.code.cpp.security.FlowSources
2424
";MyDerivedClass;false;subtypeRemoteMadSource2;;;ReturnValue;remote",
2525
]
2626
}
27-
}*/
27+
}
2828

2929
/**
3030
* Models-as-data sink models for this test.
3131
*/
32-
/*private class TestSinks extends SinkModelCsv {
32+
private class TestSinks extends SinkModelCsv {
3333
override predicate row(string row) {
3434
row =
3535
[
@@ -43,12 +43,12 @@ import semmle.code.cpp.security.FlowSources
4343
";MyClass;true;memberMadSinkVar;;;;test-sink",
4444
]
4545
}
46-
}*/
46+
}
4747

4848
/**
4949
* Models-as-data summary models for this test.
5050
*/
51-
/*private class TestSummaries extends SummaryModelCsv {
51+
private class TestSummaries extends SummaryModelCsv {
5252
override predicate row(string row) {
5353
row =
5454
[
@@ -66,7 +66,7 @@ import semmle.code.cpp.security.FlowSources
6666
";MyClass;true;madFieldToReturn;;;Argument[-1].val;ReturnValue;taint",
6767
]
6868
}
69-
}*/
69+
}
7070

7171
module IRTest {
7272
private import semmle.code.cpp.ir.IR
@@ -81,8 +81,8 @@ module IRTest {
8181
}
8282

8383
predicate isSink(DataFlow::Node sink) {
84-
//sinkNode(sink, "test-sink")
85-
//or
84+
sinkNode(sink, "test-sink")
85+
or
8686
exists(FunctionCall call |
8787
call.getTarget().getName() = "sink" and
8888
[sink.asExpr(), sink.asIndirectExpr()] = call.getAnArgument()

cpp/ql/test/library-tests/dataflow/models-as-data/tests.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ void test_sources() {
2121

2222
// test sources
2323

24-
sink(localMadSource()); // $ MISSING: ir
25-
sink(remoteMadSource()); // $ MISSING: ir
24+
sink(localMadSource()); // $ ir
25+
sink(remoteMadSource()); // $ ir
2626
sink(notASource());
27-
sink(localMadSourceHasBody()); // $ MISSING: ir
27+
sink(localMadSourceHasBody()); // $ ir
2828
sink(*remoteMadSourceIndirect()); // $ MISSING: ir
2929

3030
int a, b, c, d;
@@ -41,7 +41,7 @@ void test_sources() {
4141

4242
void remoteMadSourceParam0(int x)
4343
{
44-
sink(x); // $ MISSING: ir
44+
sink(x); // $ ir
4545
}
4646

4747
// --- global MAD sinks ---
@@ -180,20 +180,20 @@ void test_class_members() {
180180

181181
// test class member sources
182182

183-
sink(mc.memberRemoteMadSource()); // $ MISSING: ir
183+
sink(mc.memberRemoteMadSource()); // $ ir
184184

185185
int a;
186186
mc.memberRemoteMadSourceArg0(&a);
187187
sink(a); // $ MISSING: ir
188188

189-
sink(mc.memberRemoteMadSourceVar); // $ MISSING: ir
189+
sink(mc.memberRemoteMadSourceVar); // $ ir
190190

191191
// test subtype sources
192192

193-
sink(mdc.memberRemoteMadSource()); // $ MISSING: ir
194-
sink(mdc.subtypeRemoteMadSource1()); // $ MISSING: ir
193+
sink(mdc.memberRemoteMadSource()); // $ ir
194+
sink(mdc.subtypeRemoteMadSource1()); // $ ir
195195
sink(mdc.subtypeNonSource());
196-
sink(mdc.subtypeRemoteMadSource2()); // $ MISSING: ir
196+
sink(mdc.subtypeRemoteMadSource2()); // $ ir
197197

198198
// test class member sinks
199199

0 commit comments

Comments
 (0)