Skip to content

Commit 02a0cbf

Browse files
committed
C#: Add test cases.
1 parent 99bbca8 commit 02a0cbf

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

csharp/ql/test/utils/model-generator/CaptureSummaryModels.expected

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
| Summaries;DerivedClass1Flow;false;ReturnParam1;(System.Int32,System.Int32);Argument[1];ReturnValue;taint |
1919
| Summaries;DerivedClass2Flow;false;ReturnParam0;(System.Int32,System.Int32);Argument[0];ReturnValue;taint |
2020
| Summaries;DerivedClass2Flow;false;ReturnParam;(System.Int32);Argument[0];ReturnValue;taint |
21+
| Summaries;EqualsGetHashCodeNoFlow;false;Equals;(System.Int32);Argument[0];ReturnValue;taint |
2122
| Summaries;GenericFlow<>;false;AddFieldToGenericList;(System.Collections.Generic.List<T>);Argument[Qualifier];Argument[0].Element;taint |
2223
| Summaries;GenericFlow<>;false;AddToGenericList<>;(System.Collections.Generic.List<S>,S);Argument[1];Argument[0].Element;taint |
2324
| Summaries;GenericFlow<>;false;ReturnFieldInGenericList;();Argument[Qualifier];ReturnValue;taint |

csharp/ql/test/utils/model-generator/Summaries.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,4 +206,28 @@ public static explicit operator OperatorFlow(byte b)
206206
return new OperatorFlow(b);
207207
}
208208

209+
}
210+
211+
public class EqualsGetHashCodeNoFlow
212+
{
213+
public readonly bool boolTainted;
214+
public readonly int intTainted;
215+
216+
// No flow summary as this is an override of the Equals method.
217+
public override bool Equals(object obj)
218+
{
219+
return boolTainted;
220+
}
221+
222+
// Flow summary as this is not an override of the object Equals method.
223+
public int Equals(int i)
224+
{
225+
return i;
226+
}
227+
228+
// No flow summary as this is an override of the GetHashCode method.
229+
public override int GetHashCode()
230+
{
231+
return intTainted;
232+
}
209233
}

0 commit comments

Comments
 (0)