mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
C#: Update ContentDataFlow test
Illustrates missing flow when the sink is inside a method that is also part of a `subpath`.
This commit is contained in:
@@ -16,16 +16,36 @@ public class ContentFlow
|
||||
public void M(A a, B b)
|
||||
{
|
||||
var a1 = new A();
|
||||
Sink(a1.FieldA.FieldB);
|
||||
Sink(Through(a1.FieldA.FieldB));
|
||||
|
||||
a.FieldA.FieldB = new B();
|
||||
Sink(a);
|
||||
Sink(Through(a));
|
||||
|
||||
var a2 = new A();
|
||||
b.FieldB.FieldA = a2.FieldB.FieldA;
|
||||
Sink(b);
|
||||
Sink(Through(b));
|
||||
|
||||
Sink(Through(Out()));
|
||||
|
||||
In(new A().FieldA.FieldB);
|
||||
}
|
||||
|
||||
public static void Sink<T>(T t) { }
|
||||
|
||||
public T Through<T>(T t)
|
||||
{
|
||||
Sink(t);
|
||||
return t;
|
||||
}
|
||||
|
||||
public void In<T>(T t)
|
||||
{
|
||||
Sink(t);
|
||||
}
|
||||
|
||||
public B Out()
|
||||
{
|
||||
var a = new A();
|
||||
return a.FieldA.FieldB;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
| ContentFlow.cs:18:18:18:24 | object creation of type A | field FieldB.field FieldA. | ContentFlow.cs:19:14:19:29 | access to field FieldB | | true |
|
||||
| ContentFlow.cs:21:27:21:33 | object creation of type B | | ContentFlow.cs:22:14:22:14 | access to parameter a | field FieldA.field FieldB. | true |
|
||||
| ContentFlow.cs:24:18:24:24 | object creation of type A | field FieldA.field FieldB. | ContentFlow.cs:26:14:26:14 | access to parameter b | field FieldB.field FieldA. | true |
|
||||
| ContentFlow.cs:18:18:18:24 | object creation of type A | field FieldB.field FieldA. | ContentFlow.cs:19:14:19:38 | call to method Through<B> | | true |
|
||||
| ContentFlow.cs:21:27:21:33 | object creation of type B | | ContentFlow.cs:22:14:22:23 | call to method Through<A> | field FieldA.field FieldB. | true |
|
||||
| ContentFlow.cs:24:18:24:24 | object creation of type A | field FieldA.field FieldB. | ContentFlow.cs:26:14:26:23 | call to method Through<B> | field FieldB.field FieldA. | true |
|
||||
| ContentFlow.cs:30:12:30:18 | object creation of type A | field FieldB.field FieldA. | ContentFlow.cs:43:14:43:14 | access to parameter t | | true |
|
||||
| ContentFlow.cs:48:17:48:23 | object creation of type A | field FieldB.field FieldA. | ContentFlow.cs:28:14:28:27 | call to method Through<B> | | true |
|
||||
|
||||
Reference in New Issue
Block a user