11using System ;
2+ using System . Linq ;
3+ using System . Collections . Generic ;
24
35namespace Summaries ;
46
@@ -31,6 +33,21 @@ public string ReturnSubstring(string s)
3133 return s . Substring ( 0 , 1 ) ;
3234 }
3335
36+ public void SetField ( string s )
37+ {
38+ tainted = s ;
39+ }
40+
41+ public string ReturnField ( )
42+ {
43+ return tainted ;
44+ }
45+ }
46+
47+ public class CollectionFlow
48+ {
49+ private string tainted ;
50+
3451 public int ReturnArrayElement ( int [ ] input )
3552 {
3653 return input [ 0 ] ;
@@ -41,18 +58,117 @@ public void AssignToArray(int data, int[] target)
4158 target [ 0 ] = data ;
4259 }
4360
44- public void SetField ( string s )
61+ public void AssignFieldToArray ( object [ ] target )
4562 {
46- tainted = s ;
63+ target [ 0 ] = tainted ;
4764 }
4865
49- public string ReturnField ( )
66+ public object ReturnListElement ( List < object > input )
67+ {
68+ return input [ 0 ] ;
69+ }
70+
71+ public void AddToList ( List < object > input , object data )
72+ {
73+ input . Add ( data ) ;
74+ }
75+
76+ public void AddFieldToList ( List < string > input )
77+ {
78+ input . Add ( tainted ) ;
79+ }
80+
81+ public List < string > ReturnFieldInAList ( )
82+ {
83+ return new List < string > { tainted } ;
84+ }
85+ }
86+
87+ public class IEnumerableFlow
88+ {
89+ private string tainted ;
90+
91+ public IEnumerable < string > ReturnIEnumerable ( IEnumerable < string > input )
92+ {
93+ return input ;
94+ }
95+
96+ public object ReturnIEnumerableElement ( IEnumerable < object > input )
97+ {
98+ return input . First ( ) ;
99+ }
100+
101+ public IEnumerable < string > ReturnFieldInIEnumerable ( )
102+ {
103+ return new List < string > { tainted } ;
104+ }
105+ }
106+
107+ public class GenericFlow < T >
108+ {
109+ private T tainted ;
110+
111+ public void SetGenericField ( T t )
112+ {
113+ tainted = t ;
114+ }
115+
116+ public T ReturnGenericField ( )
50117 {
51118 return tainted ;
52119 }
53120
54- public void AssignFieldToArray ( object [ ] target )
121+ public void AddFieldToGenericList ( List < T > input )
55122 {
56- target [ 0 ] = tainted ;
123+ input . Add ( tainted ) ;
124+ }
125+
126+ public List < T > ReturnFieldInGenericList ( )
127+ {
128+ return new List < T > { tainted } ;
129+ }
130+
131+ public S ReturnGenericParam < S > ( S input )
132+ {
133+ return input ;
134+ }
135+
136+ public S ReturnGenericElement < S > ( List < S > input )
137+ {
138+ return input [ 0 ] ;
139+ }
140+
141+ public void AddToGenericList < S > ( List < S > input , S data )
142+ {
143+ input . Add ( data ) ;
57144 }
58145}
146+
147+ public abstract class BaseClassFlow
148+ {
149+ public virtual int ReturnParam ( int input )
150+ {
151+ return input ;
152+ }
153+ }
154+
155+ public class DerivedClass1Flow : BaseClassFlow
156+ {
157+ public int ReturnParam1 ( int input0 , int input1 )
158+ {
159+ return input1 ;
160+ }
161+ }
162+
163+ public class DerivedClass2Flow : BaseClassFlow
164+ {
165+ public override int ReturnParam ( int input )
166+ {
167+ return input ;
168+ }
169+
170+ public int ReturnParam0 ( int input0 , int input1 )
171+ {
172+ return input0 ;
173+ }
174+ }
0 commit comments