File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed
cpp/ql/test/library-tests/dataflow/taint-tests Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 6245
6245
| taint.cpp:657:12:657:15 | call to data | taint.cpp:657:3:657:8 | call to memcpy | |
6246
6246
| taint.cpp:657:20:657:25 | source | taint.cpp:657:3:657:8 | call to memcpy | TAINT |
6247
6247
| taint.cpp:657:20:657:25 | source | taint.cpp:657:12:657:15 | ref arg call to data | TAINT |
6248
+ | taint.cpp:668:14:668:14 | s | taint.cpp:669:18:669:18 | s | |
6249
+ | taint.cpp:668:14:668:14 | s | taint.cpp:671:7:671:7 | s | |
6250
+ | taint.cpp:668:14:668:14 | s | taint.cpp:672:7:672:7 | s | |
6251
+ | taint.cpp:668:14:668:14 | s | taint.cpp:673:7:673:7 | s | |
6252
+ | taint.cpp:669:18:669:18 | s [post update] | taint.cpp:671:7:671:7 | s | |
6253
+ | taint.cpp:669:18:669:18 | s [post update] | taint.cpp:672:7:672:7 | s | |
6254
+ | taint.cpp:669:18:669:18 | s [post update] | taint.cpp:673:7:673:7 | s | |
6255
+ | taint.cpp:672:7:672:7 | s [post update] | taint.cpp:673:7:673:7 | s | |
6248
6256
| vector.cpp:16:43:16:49 | source1 | vector.cpp:17:26:17:32 | source1 | |
6249
6257
| vector.cpp:16:43:16:49 | source1 | vector.cpp:31:38:31:44 | source1 | |
6250
6258
| vector.cpp:17:21:17:33 | call to vector | vector.cpp:19:14:19:14 | v | |
Original file line number Diff line number Diff line change @@ -656,4 +656,19 @@ void test_with_const_member(char* source) {
656
656
C_const_member_function c;
657
657
memcpy (c.data (), source, 16 );
658
658
sink (c.data ()); // $ ast MISSING: ir
659
+ }
660
+
661
+ void argument_source (void *);
662
+
663
+ struct two_members {
664
+ char *x, *y;
665
+ };
666
+
667
+ void test_argument_source_field_to_obj () {
668
+ two_members s;
669
+ argument_source (s.x );
670
+
671
+ sink (s); // $ SPURIOUS: ast
672
+ sink (s.x ); // $ ast MISSING: ir
673
+ sink (s.y ); // clean
659
674
}
Original file line number Diff line number Diff line change @@ -53,6 +53,11 @@ module ASTTest {
53
53
or
54
54
// Track uninitialized variables
55
55
exists ( source .asUninitialized ( ) )
56
+ or
57
+ exists ( FunctionCall fc |
58
+ fc .getAnArgument ( ) = source .asDefiningArgument ( ) and
59
+ fc .getTarget ( ) .hasName ( "argument_source" )
60
+ )
56
61
}
57
62
58
63
override predicate isSink ( DataFlow:: Node sink ) {
@@ -80,6 +85,11 @@ module IRTest {
80
85
source .( DataFlow:: ExprNode ) .getConvertedExpr ( ) .( FunctionCall ) .getTarget ( ) .getName ( ) = "source"
81
86
or
82
87
source .asParameter ( ) .getName ( ) .matches ( "source%" )
88
+ or
89
+ exists ( FunctionCall fc |
90
+ fc .getAnArgument ( ) = source .asDefiningArgument ( ) and
91
+ fc .getTarget ( ) .hasName ( "argument_source" )
92
+ )
83
93
}
84
94
85
95
override predicate isSink ( DataFlow:: Node sink ) {
You can’t perform that action at this time.
0 commit comments