mirror of
https://github.com/github/codeql.git
synced 2025-12-23 12:16:33 +01:00
C#: Add Type based summary test cases and move dataflow model generation test cases.
This commit is contained in:
@@ -259,4 +259,4 @@ public class EqualsGetHashCodeNoFlow
|
|||||||
{
|
{
|
||||||
return intTainted;
|
return intTainted;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,2 +1,2 @@
|
|||||||
semmle-extractor-options: /r:System.Linq.dll /r:System.Collections.Specialized.dll
|
semmle-extractor-options: /r:System.Linq.dll /r:System.Collections.Specialized.dll
|
||||||
semmle-extractor-options: ${testdir}/../../resources/stubs/System.Web.cs
|
semmle-extractor-options: ${testdir}/../../../resources/stubs/System.Web.cs
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
| Summaries;CollectionTheorems1<>;false;Add;(T);;Argument[0];Argument[this].SyntheticField[ArgT].Element;taint;generated |
|
||||||
|
| Summaries;CollectionTheorems1<>;false;First;();;Argument[this].SyntheticField[ArgT].Element;ReturnValue;taint;generated |
|
||||||
|
| Summaries;Theorems1<>;false;Apply;(System.Func<T,System.Int32>);;Argument[this].SyntheticField[ArgT];Argument[0].Parameter[0];taint;generated |
|
||||||
|
| Summaries;Theorems1<>;false;Get;();;Argument[this].SyntheticField[ArgT];ReturnValue;taint;generated |
|
||||||
|
| Summaries;Theorems1<>;false;Get;(System.Object);;Argument[this].SyntheticField[ArgT];ReturnValue;taint;generated |
|
||||||
|
| Summaries;Theorems1<>;false;Id;(T);;Argument[0];ReturnValue;taint;generated |
|
||||||
|
| Summaries;Theorems1<>;false;Set;(System.Int32,T);;Argument[1];Argument[this].SyntheticField[ArgT];taint;generated |
|
||||||
|
| Summaries;Theorems1<>;false;Set;(T);;Argument[0];Argument[this].SyntheticField[ArgT];taint;generated |
|
||||||
|
| Summaries;Theorems1<>;false;Theorems1;(T);;Argument[0];Argument[this].SyntheticField[ArgT];taint;generated |
|
||||||
|
| Summaries;Theorems1<>;false;Transform;(System.Int32,T);;Argument[1];ReturnValue;taint;generated |
|
||||||
|
| Summaries;Theorems1<>;false;Transform<>;(S);;Argument[0];ReturnValue;taint;generated |
|
||||||
|
| Summaries;Theorems1<>;false;get_Prop;();;Argument[this].SyntheticField[ArgT];ReturnValue;taint;generated |
|
||||||
|
| Summaries;Theorems1<>;false;set_Prop;(T);;Argument[0];Argument[this].SyntheticField[ArgT];taint;generated |
|
||||||
|
| Summaries;Theorems2;false;Transform<>;(T);;Argument[0];ReturnValue;taint;generated |
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
utils/model-generator/CaptureTheoremsForFreeSummaryModels.ql
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Collections;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace Summaries;
|
||||||
|
|
||||||
|
public class Theorems1<T> {
|
||||||
|
|
||||||
|
public T Prop {
|
||||||
|
get { throw null; }
|
||||||
|
set { throw null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public Theorems1(T t) { throw null; }
|
||||||
|
|
||||||
|
public T Get() { throw null; }
|
||||||
|
|
||||||
|
public T Get(object x) { throw null; }
|
||||||
|
|
||||||
|
public T Id(T x) { throw null; }
|
||||||
|
|
||||||
|
public T Transform(int x, T y) { throw null; }
|
||||||
|
|
||||||
|
public S Transform<S>(S x) { throw null; }
|
||||||
|
|
||||||
|
public void Set(T x) { throw null; }
|
||||||
|
|
||||||
|
public void Set(int x, T y) { throw null; }
|
||||||
|
|
||||||
|
// No summary as S is unrelated to T
|
||||||
|
public void Set<S>(S x) { throw null; }
|
||||||
|
|
||||||
|
public int Apply(Func<T, int> f) { throw null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class Theorems2 {
|
||||||
|
|
||||||
|
public T Transform<T>(T x) { throw null; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class CollectionTheorems1<T> : IEnumerable<T> {
|
||||||
|
IEnumerator<T> IEnumerable<T>.GetEnumerator() { throw null; }
|
||||||
|
IEnumerator IEnumerable.GetEnumerator() { throw null; }
|
||||||
|
|
||||||
|
public T First() { throw null; }
|
||||||
|
|
||||||
|
public void Add(T x) { throw null; }
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user