mirror of
https://github.com/github/codeql.git
synced 2026-03-30 20:28:15 +02:00
C#: Add data flow test for partial method.
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
models
|
||||
edges
|
||||
| Methods.cs:3:48:3:48 | o : Object | Methods.cs:10:16:10:16 | access to parameter o : Object | provenance | |
|
||||
| Methods.cs:3:48:3:48 | o : Object | Methods.cs:10:16:10:16 | access to parameter o : Object | provenance | |
|
||||
| Methods.cs:3:48:3:48 | o : Object | Methods.cs:10:16:10:16 | access to parameter o : Object | provenance | |
|
||||
| Methods.cs:3:48:3:48 | o : Object | Methods.cs:10:16:10:16 | access to parameter o : Object | provenance | |
|
||||
| Methods.cs:8:48:8:48 | o : Object | Methods.cs:10:16:10:16 | access to parameter o : Object | provenance | |
|
||||
| Methods.cs:8:48:8:48 | o : Object | Methods.cs:10:16:10:16 | access to parameter o : Object | provenance | |
|
||||
| Methods.cs:8:48:8:48 | o : Object | Methods.cs:10:16:10:16 | access to parameter o : Object | provenance | |
|
||||
| Methods.cs:8:48:8:48 | o : Object | Methods.cs:10:16:10:16 | access to parameter o : Object | provenance | |
|
||||
| Methods.cs:17:13:17:13 | access to local variable o : Object | Methods.cs:19:38:19:38 | access to local variable o : Object | provenance | |
|
||||
| Methods.cs:17:13:17:13 | access to local variable o : Object | Methods.cs:19:38:19:38 | access to local variable o : Object | provenance | |
|
||||
| Methods.cs:17:17:17:33 | call to method Source<Object> : Object | Methods.cs:17:13:17:13 | access to local variable o : Object | provenance | |
|
||||
| Methods.cs:17:17:17:33 | call to method Source<Object> : Object | Methods.cs:17:13:17:13 | access to local variable o : Object | provenance | |
|
||||
| Methods.cs:19:13:19:18 | access to local variable result : Object | Methods.cs:20:14:20:19 | access to local variable result | provenance | |
|
||||
| Methods.cs:19:13:19:18 | access to local variable result : Object | Methods.cs:20:14:20:19 | access to local variable result | provenance | |
|
||||
| Methods.cs:19:22:19:39 | call to method PartialMethod : Object | Methods.cs:19:13:19:18 | access to local variable result : Object | provenance | |
|
||||
| Methods.cs:19:22:19:39 | call to method PartialMethod : Object | Methods.cs:19:13:19:18 | access to local variable result : Object | provenance | |
|
||||
| Methods.cs:19:38:19:38 | access to local variable o : Object | Methods.cs:3:48:3:48 | o : Object | provenance | |
|
||||
| Methods.cs:19:38:19:38 | access to local variable o : Object | Methods.cs:3:48:3:48 | o : Object | provenance | |
|
||||
| Methods.cs:19:38:19:38 | access to local variable o : Object | Methods.cs:8:48:8:48 | o : Object | provenance | |
|
||||
| Methods.cs:19:38:19:38 | access to local variable o : Object | Methods.cs:8:48:8:48 | o : Object | provenance | |
|
||||
| Methods.cs:19:38:19:38 | access to local variable o : Object | Methods.cs:19:22:19:39 | call to method PartialMethod : Object | provenance | |
|
||||
| Methods.cs:19:38:19:38 | access to local variable o : Object | Methods.cs:19:22:19:39 | call to method PartialMethod : Object | provenance | |
|
||||
nodes
|
||||
| Methods.cs:3:48:3:48 | o : Object | semmle.label | o : Object |
|
||||
| Methods.cs:3:48:3:48 | o : Object | semmle.label | o : Object |
|
||||
| Methods.cs:8:48:8:48 | o : Object | semmle.label | o : Object |
|
||||
| Methods.cs:8:48:8:48 | o : Object | semmle.label | o : Object |
|
||||
| Methods.cs:10:16:10:16 | access to parameter o : Object | semmle.label | access to parameter o : Object |
|
||||
| Methods.cs:10:16:10:16 | access to parameter o : Object | semmle.label | access to parameter o : Object |
|
||||
| Methods.cs:10:16:10:16 | access to parameter o : Object | semmle.label | access to parameter o : Object |
|
||||
| Methods.cs:10:16:10:16 | access to parameter o : Object | semmle.label | access to parameter o : Object |
|
||||
| Methods.cs:17:13:17:13 | access to local variable o : Object | semmle.label | access to local variable o : Object |
|
||||
| Methods.cs:17:13:17:13 | access to local variable o : Object | semmle.label | access to local variable o : Object |
|
||||
| Methods.cs:17:17:17:33 | call to method Source<Object> : Object | semmle.label | call to method Source<Object> : Object |
|
||||
| Methods.cs:17:17:17:33 | call to method Source<Object> : Object | semmle.label | call to method Source<Object> : Object |
|
||||
| Methods.cs:19:13:19:18 | access to local variable result : Object | semmle.label | access to local variable result : Object |
|
||||
| Methods.cs:19:13:19:18 | access to local variable result : Object | semmle.label | access to local variable result : Object |
|
||||
| Methods.cs:19:22:19:39 | call to method PartialMethod : Object | semmle.label | call to method PartialMethod : Object |
|
||||
| Methods.cs:19:22:19:39 | call to method PartialMethod : Object | semmle.label | call to method PartialMethod : Object |
|
||||
| Methods.cs:19:38:19:38 | access to local variable o : Object | semmle.label | access to local variable o : Object |
|
||||
| Methods.cs:19:38:19:38 | access to local variable o : Object | semmle.label | access to local variable o : Object |
|
||||
| Methods.cs:20:14:20:19 | access to local variable result | semmle.label | access to local variable result |
|
||||
| Methods.cs:20:14:20:19 | access to local variable result | semmle.label | access to local variable result |
|
||||
subpaths
|
||||
| Methods.cs:19:38:19:38 | access to local variable o : Object | Methods.cs:3:48:3:48 | o : Object | Methods.cs:10:16:10:16 | access to parameter o : Object | Methods.cs:19:22:19:39 | call to method PartialMethod : Object |
|
||||
| Methods.cs:19:38:19:38 | access to local variable o : Object | Methods.cs:3:48:3:48 | o : Object | Methods.cs:10:16:10:16 | access to parameter o : Object | Methods.cs:19:22:19:39 | call to method PartialMethod : Object |
|
||||
| Methods.cs:19:38:19:38 | access to local variable o : Object | Methods.cs:3:48:3:48 | o : Object | Methods.cs:10:16:10:16 | access to parameter o : Object | Methods.cs:19:22:19:39 | call to method PartialMethod : Object |
|
||||
| Methods.cs:19:38:19:38 | access to local variable o : Object | Methods.cs:3:48:3:48 | o : Object | Methods.cs:10:16:10:16 | access to parameter o : Object | Methods.cs:19:22:19:39 | call to method PartialMethod : Object |
|
||||
| Methods.cs:19:38:19:38 | access to local variable o : Object | Methods.cs:8:48:8:48 | o : Object | Methods.cs:10:16:10:16 | access to parameter o : Object | Methods.cs:19:22:19:39 | call to method PartialMethod : Object |
|
||||
| Methods.cs:19:38:19:38 | access to local variable o : Object | Methods.cs:8:48:8:48 | o : Object | Methods.cs:10:16:10:16 | access to parameter o : Object | Methods.cs:19:22:19:39 | call to method PartialMethod : Object |
|
||||
| Methods.cs:19:38:19:38 | access to local variable o : Object | Methods.cs:8:48:8:48 | o : Object | Methods.cs:10:16:10:16 | access to parameter o : Object | Methods.cs:19:22:19:39 | call to method PartialMethod : Object |
|
||||
| Methods.cs:19:38:19:38 | access to local variable o : Object | Methods.cs:8:48:8:48 | o : Object | Methods.cs:10:16:10:16 | access to parameter o : Object | Methods.cs:19:22:19:39 | call to method PartialMethod : Object |
|
||||
testFailures
|
||||
#select
|
||||
| Methods.cs:20:14:20:19 | access to local variable result | Methods.cs:17:17:17:33 | call to method Source<Object> : Object | Methods.cs:20:14:20:19 | access to local variable result | $@ | Methods.cs:17:17:17:33 | call to method Source<Object> : Object | call to method Source<Object> : Object |
|
||||
| Methods.cs:20:14:20:19 | access to local variable result | Methods.cs:17:17:17:33 | call to method Source<Object> : Object | Methods.cs:20:14:20:19 | access to local variable result | $@ | Methods.cs:17:17:17:33 | call to method Source<Object> : Object | call to method Source<Object> : Object |
|
||||
12
csharp/ql/test/library-tests/dataflow/methods/MethodFlow.ql
Normal file
12
csharp/ql/test/library-tests/dataflow/methods/MethodFlow.ql
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* @kind path-problem
|
||||
*/
|
||||
|
||||
import csharp
|
||||
import utils.test.InlineFlowTest
|
||||
import DefaultFlowTest
|
||||
import PathGraph
|
||||
|
||||
from PathNode source, PathNode sink
|
||||
where flowPath(source, sink)
|
||||
select sink, source, sink, "$@", source, source.toString()
|
||||
26
csharp/ql/test/library-tests/dataflow/methods/Methods.cs
Normal file
26
csharp/ql/test/library-tests/dataflow/methods/Methods.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
public partial class Partial
|
||||
{
|
||||
public partial object PartialMethod(object o);
|
||||
}
|
||||
|
||||
public partial class Partial
|
||||
{
|
||||
public partial object PartialMethod(object o)
|
||||
{
|
||||
return o;
|
||||
}
|
||||
}
|
||||
public class C
|
||||
{
|
||||
public void M()
|
||||
{
|
||||
var o = Source<object>(1);
|
||||
var p = new Partial();
|
||||
var result = p.PartialMethod(o);
|
||||
Sink(result); // $ hasValueFlow=1
|
||||
}
|
||||
|
||||
public static void Sink(object o) { }
|
||||
|
||||
static T Source<T>(object source) => throw null;
|
||||
}
|
||||
Reference in New Issue
Block a user