Skip to content

Commit 124487c

Browse files
committed
Kotlin: Add more taint tests
1 parent 821b4c7 commit 124487c

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

java/ql/test-kotlin1/library-tests/dataflow/foreach/C2.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,15 @@ class C2 {
1616
sink(s)
1717
}
1818
}
19+
20+
fun test2() {
21+
val l1 = arrayOf("")
22+
val l2 = arrayOf("")
23+
l1[0] = taint("a")
24+
l2.set(0, taint("a"))
25+
sink(l1[0])
26+
sink(l2[0])
27+
sink(l1.get(0))
28+
sink(l2.get(0))
29+
}
1930
}

java/ql/test-kotlin1/library-tests/dataflow/foreach/test.expected

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,7 @@
77
| C2.kt:8:32:8:32 | "a" | C2.kt:11:14:11:21 | get(...) |
88
| C2.kt:8:32:8:32 | "a" | C2.kt:13:18:13:21 | ...[...] |
99
| C2.kt:8:32:8:32 | "a" | C2.kt:16:18:16:18 | s |
10+
| C2.kt:23:24:23:24 | "a" | C2.kt:25:14:25:18 | ...[...] |
11+
| C2.kt:23:24:23:24 | "a" | C2.kt:27:14:27:22 | get(...) |
12+
| C2.kt:24:26:24:26 | "a" | C2.kt:26:14:26:18 | ...[...] |
13+
| C2.kt:24:26:24:26 | "a" | C2.kt:28:14:28:22 | get(...) |

0 commit comments

Comments
 (0)