Skip to content

Commit aae8660

Browse files
committed
C#/Java: Add some examples of missing synthetic field element flow.
1 parent 58513ca commit aae8660

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

csharp/ql/test/utils/modelgenerator/dataflow/Summaries.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,23 @@ public void SetProp2(string v)
839839
}
840840
}
841841

842+
public class SyntheticCollections
843+
{
844+
private object[] array;
845+
846+
// summary=Models;SyntheticCollections;false;SyntheticCollections;(System.Object[]);;Argument[0].Element;Argument[this];taint;df-generated
847+
public SyntheticCollections(object[] array)
848+
{
849+
this.array = array;
850+
}
851+
852+
// summary=Models;SyntheticCollections;false;GetElement;(System.Int32);;Argument[this];ReturnValue;taint;df-generated
853+
public object GetElement(int index)
854+
{
855+
return array[index];
856+
}
857+
}
858+
842859
public class Fanout
843860
{
844861

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package p;
2+
3+
public class SyntheticCollections {
4+
private String[] array;
5+
6+
// summary=p;SyntheticCollections;true;SyntheticCollections;(String[]);;Argument[0].ArrayElement;Argument[this];taint;df-generated
7+
public SyntheticCollections(String[] array) {
8+
this.array = array;
9+
}
10+
11+
// summary=p;SyntheticCollections;true;getElement;(Integer);;Argument[this];ReturnValue;taint;df-generated
12+
public String getElement(Integer index) {
13+
return array[index];
14+
}
15+
}

0 commit comments

Comments
 (0)