Skip to content

Commit f4a59cc

Browse files
Convert tainted arrays to arrays of tainted elements in tests
1 parent 865477d commit f4a59cc

File tree

2 files changed

+64
-64
lines changed

2 files changed

+64
-64
lines changed

java/ql/test/library-tests/frameworks/android/taint-database/FlowSteps.java

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ private static abstract class MySQLiteQueryBuilder extends SQLiteQueryBuilder {
2727
}
2828

2929
public static String[] appendSelectionArgs() {
30-
String[] originalValues = taint(); // $hasTaintFlowStep
31-
String[] newValues = taint(); // $hasTaintFlowStep
30+
String[] originalValues = {taint()}; // $hasTaintFlowStep
31+
String[] newValues = {taint()}; // $hasTaintFlowStep
3232
return DatabaseUtils.appendSelectionArgs(originalValues, newValues);
3333
}
3434

@@ -42,7 +42,7 @@ public static String buildQueryString(MySQLiteQueryBuilder target) {
4242
target = taint();
4343
boolean distinct = taint();
4444
String tables = taint(); // $hasTaintFlowStep
45-
String[] columns = taint(); // $hasTaintFlowStep
45+
String[] columns = {taint()}; // $hasTaintFlowStep
4646
String where = taint(); // $hasTaintFlowStep
4747
String groupBy = taint(); // $hasTaintFlowStep
4848
String having = taint(); // $hasTaintFlowStep
@@ -53,7 +53,7 @@ public static String buildQueryString(MySQLiteQueryBuilder target) {
5353

5454
public static String buildQuery(MySQLiteQueryBuilder target) {
5555
target = taint(); // $hasTaintFlowStep
56-
String[] projectionIn = taint();// $hasTaintFlowStep
56+
String[] projectionIn = {taint()};// $hasTaintFlowStep
5757
String selection = taint(); // $hasTaintFlowStep
5858
String groupBy = taint(); // $hasTaintFlowStep
5959
String having = taint(); // $hasTaintFlowStep
@@ -64,9 +64,9 @@ public static String buildQuery(MySQLiteQueryBuilder target) {
6464

6565
public static String buildQuery2(MySQLiteQueryBuilder target) {
6666
target = taint(); // $hasTaintFlowStep
67-
String[] projectionIn = taint(); // $hasTaintFlowStep
67+
String[] projectionIn = {taint()}; // $hasTaintFlowStep
6868
String selection = taint(); // $hasTaintFlowStep
69-
String[] selectionArgs = taint(); // $hasTaintFlowStep
69+
String[] selectionArgs = {taint()}; // $hasTaintFlowStep
7070
String groupBy = taint(); // $hasTaintFlowStep
7171
String having = taint(); // $hasTaintFlowStep
7272
String sortOrder = taint(); // $hasTaintFlowStep
@@ -76,7 +76,7 @@ public static String buildQuery2(MySQLiteQueryBuilder target) {
7676

7777
public static String buildUnionQuery(MySQLiteQueryBuilder target) {
7878
target = taint(); // $hasTaintFlowStep
79-
String[] subQueries = taint(); // $hasTaintFlowStep
79+
String[] subQueries = {taint()}; // $hasTaintFlowStep
8080
String sortOrder = taint(); // $hasTaintFlowStep
8181
String limit = taint(); // $hasTaintFlowStep
8282
return target.buildUnionQuery(subQueries, sortOrder, limit);
@@ -85,12 +85,12 @@ public static String buildUnionQuery(MySQLiteQueryBuilder target) {
8585
public static String buildUnionSubQuery2(MySQLiteQueryBuilder target) {
8686
target = taint(); // $hasTaintFlowStep
8787
String typeDiscriminatorColumn = taint(); // $hasTaintFlowStep
88-
String[] unionColumns = taint(); // $hasTaintFlowStep
88+
String[] unionColumns = {taint()}; // $hasTaintFlowStep
8989
Set<String> columnsPresentInTable = taint(); // $hasTaintFlowStep
9090
int computedColumnsOffset = taint();
9191
String typeDiscriminatorValue = taint(); // $hasTaintFlowStep
9292
String selection = taint(); // $hasTaintFlowStep
93-
String[] selectionArgs = taint(); // $hasTaintFlowStep
93+
String[] selectionArgs = {taint()}; // $hasTaintFlowStep
9494
String groupBy = taint(); // $hasTaintFlowStep
9595
String having = taint(); // $hasTaintFlowStep
9696
return target.buildUnionSubQuery(typeDiscriminatorColumn, unionColumns, columnsPresentInTable,
@@ -100,7 +100,7 @@ public static String buildUnionSubQuery2(MySQLiteQueryBuilder target) {
100100
public static String buildUnionSubQuery3(MySQLiteQueryBuilder target) {
101101
target = taint(); // $hasTaintFlowStep
102102
String typeDiscriminatorColumn = taint(); // $hasTaintFlowStep
103-
String[] unionColumns = taint(); // $hasTaintFlowStep
103+
String[] unionColumns = {taint()}; // $hasTaintFlowStep
104104
Set<String> columnsPresentInTable = taint(); // $hasTaintFlowStep
105105
int computedColumnsOffset = taint();
106106
String typeDiscriminatorValue = taint(); // $hasTaintFlowStep
@@ -113,45 +113,45 @@ public static String buildUnionSubQuery3(MySQLiteQueryBuilder target) {
113113

114114
public static Cursor query(MyContentResolver target) {
115115
Uri uri = taint(); // $hasTaintFlowStep
116-
String[] projection = taint();
116+
String[] projection = {taint()};
117117
String selection = taint(); // $hasTaintFlowSink
118-
String[] selectionArgs = taint();
118+
String[] selectionArgs = {taint()};
119119
String sortOrder = taint();
120120
CancellationSignal cancellationSignal = taint();
121121
return target.query(uri, projection, selection, selectionArgs, sortOrder, cancellationSignal);
122122
}
123123

124124
public static Cursor query(MyContentProvider target) {
125125
Uri uri = taint(); // $hasTaintFlowStep
126-
String[] projection = taint();
126+
String[] projection = {taint()};
127127
String selection = taint(); // $hasTaintFlowSink
128-
String[] selectionArgs = taint();
128+
String[] selectionArgs = {taint()};
129129
String sortOrder = taint();
130130
CancellationSignal cancellationSignal = taint();
131131
return target.query(uri, projection, selection, selectionArgs, sortOrder, cancellationSignal);
132132
}
133133

134134
public static Cursor query2(MyContentResolver target) {
135135
Uri uri = taint(); // $hasTaintFlowStep
136-
String[] projection = taint();
136+
String[] projection = {taint()};
137137
String selection = taint(); // $hasTaintFlowSink
138-
String[] selectionArgs = taint();
138+
String[] selectionArgs = {taint()};
139139
String sortOrder = taint();
140140
return target.query(uri, projection, selection, selectionArgs, sortOrder);
141141
}
142142

143143
public static Cursor query2(MyContentProvider target) {
144144
Uri uri = taint(); // $hasTaintFlowStep
145-
String[] projection = taint();
145+
String[] projection = {taint()};
146146
String selection = taint(); // $hasTaintFlowSink
147-
String[] selectionArgs = taint();
147+
String[] selectionArgs = {taint()};
148148
String sortOrder = taint();
149149
return target.query(uri, projection, selection, selectionArgs, sortOrder);
150150
}
151151

152152
public static StringBuilder appendColumns() {
153153
StringBuilder s = taint(); // $hasTaintFlowStep
154-
String[] columns = taint(); // $hasTaintFlowStep
154+
String[] columns = {taint()}; // $hasTaintFlowStep
155155
SQLiteQueryBuilder.appendColumns(s, columns);
156156
return s;
157157
}

0 commit comments

Comments
 (0)