File tree Expand file tree Collapse file tree 2 files changed +39
-9
lines changed
csharp/ql/test/utils/model-generator Expand file tree Collapse file tree 2 files changed +39
-9
lines changed Original file line number Diff line number Diff line change 1
- | Summaries;BasicFlow;false;AssignFieldToArray;(System.Object[]);Argument[Qualifier];Argument[0].Element;taint |
2
- | Summaries;BasicFlow;false;AssignToArray;(System.Int32,System.Int32[]);Argument[0];Argument[1].Element;taint |
3
- | Summaries;BasicFlow;false;ReturnArrayElement;(System.Int32[]);Argument[0].Element;ReturnValue;taint |
4
1
| Summaries;BasicFlow;false;ReturnField;();Argument[Qualifier];ReturnValue;taint |
5
2
| Summaries;BasicFlow;false;ReturnParam0;(System.String,System.Object);Argument[0];ReturnValue;taint |
6
3
| Summaries;BasicFlow;false;ReturnParam1;(System.String,System.Object);Argument[1];ReturnValue;taint |
9
6
| Summaries;BasicFlow;false;ReturnSubstring;(System.String);Argument[0];ReturnValue;taint |
10
7
| Summaries;BasicFlow;false;ReturnThis;(System.Object);Argument[Qualifier];ReturnValue;value |
11
8
| Summaries;BasicFlow;false;SetField;(System.String);Argument[0];Argument[Qualifier];taint |
9
+ | Summaries;CollectionFlow;false;AddFieldToList;(System.Collections.Generic.List<System.String>);Argument[Qualifier];Argument[0].Element;taint |
10
+ | Summaries;CollectionFlow;false;AddToList;(System.Collections.Generic.List<System.Object>,System.Object);Argument[1];Argument[0].Element;taint |
11
+ | Summaries;CollectionFlow;false;AssignFieldToArray;(System.Object[]);Argument[Qualifier];Argument[0].Element;taint |
12
+ | Summaries;CollectionFlow;false;AssignToArray;(System.Int32,System.Int32[]);Argument[0];Argument[1].Element;taint |
13
+ | Summaries;CollectionFlow;false;ReturnArrayElement;(System.Int32[]);Argument[0].Element;ReturnValue;taint |
14
+ | Summaries;CollectionFlow;false;ReturnFieldInAList;();Argument[Qualifier];ReturnValue;taint |
15
+ | Summaries;CollectionFlow;false;ReturnListElement;(System.Collections.Generic.List<System.Object>);Argument[0].Element;ReturnValue;taint |
Original file line number Diff line number Diff line change 1
1
using System ;
2
+ using System . Collections . Generic ;
2
3
3
4
namespace Summaries ;
4
5
@@ -31,6 +32,21 @@ public string ReturnSubstring(string s)
31
32
return s . Substring ( 0 , 1 ) ;
32
33
}
33
34
35
+ public void SetField ( string s )
36
+ {
37
+ tainted = s ;
38
+ }
39
+
40
+ public string ReturnField ( )
41
+ {
42
+ return tainted ;
43
+ }
44
+ }
45
+
46
+ public class CollectionFlow
47
+ {
48
+ private string tainted ;
49
+
34
50
public int ReturnArrayElement ( int [ ] input )
35
51
{
36
52
return input [ 0 ] ;
@@ -41,18 +57,28 @@ public void AssignToArray(int data, int[] target)
41
57
target [ 0 ] = data ;
42
58
}
43
59
44
- public void SetField ( string s )
60
+ public void AssignFieldToArray ( object [ ] target )
45
61
{
46
- tainted = s ;
62
+ target [ 0 ] = tainted ;
47
63
}
48
64
49
- public string ReturnField ( )
65
+ public object ReturnListElement ( List < object > input )
50
66
{
51
- return tainted ;
67
+ return input [ 0 ] ;
52
68
}
53
69
54
- public void AssignFieldToArray ( object [ ] target )
70
+ public void AddToList ( List < object > input , object data )
55
71
{
56
- target [ 0 ] = tainted ;
72
+ input . Add ( data ) ;
73
+ }
74
+
75
+ public void AddFieldToList ( List < string > input )
76
+ {
77
+ input . Add ( tainted ) ;
78
+ }
79
+
80
+ public List < string > ReturnFieldInAList ( )
81
+ {
82
+ return new List < string > { tainted } ;
57
83
}
58
84
}
You can’t perform that action at this time.
0 commit comments