mirror of
https://github.com/github/codeql.git
synced 2026-04-25 16:55:19 +02:00
C#: Add a data flow test for side effects on static fields
This commit is contained in:
19
csharp/ql/test/library-tests/dataflow/fields/K.cs
Normal file
19
csharp/ql/test/library-tests/dataflow/fields/K.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
public class K
|
||||
{
|
||||
static string[] Strings = new string[10];
|
||||
|
||||
private void M1()
|
||||
{
|
||||
var o = Source<string>(1);
|
||||
Strings[0] = o;
|
||||
}
|
||||
|
||||
private void M2()
|
||||
{
|
||||
Sink(Strings[0]); // $ MISSING: hasValueFlow=1
|
||||
}
|
||||
|
||||
public static void Sink(object o) { }
|
||||
|
||||
static T Source<T>(object source) => throw null;
|
||||
}
|
||||
Reference in New Issue
Block a user