mirror of
https://github.com/github/codeql.git
synced 2026-07-08 21:15:32 +02:00
kotlin tests: sync dataflow/foreach test inputs and K2 expected output
Copy K1's richer C2.kt (which includes test2, test3 and l.get(0) in test) into test-kotlin2. K2 in -language 2.0 mode already tracks dataflow through array.set() and indirect wrapper calls, so the additional tests produce results identical to K1. The expected files for test-kotlin1 and test-kotlin2 are now byte-identical for this test. Verified: - test-kotlin1 (kotlinc 2.3.20 / -language 1.9): all tests pass - test-kotlin2 (kotlinc 2.4.0 / -language 2.0): all tests pass Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -8,6 +8,7 @@ class C2 {
|
||||
val l = arrayOf(taint("a"), "")
|
||||
sink(l)
|
||||
sink(l[0])
|
||||
sink(l.get(0))
|
||||
for (i in l.indices) {
|
||||
sink(l[i])
|
||||
}
|
||||
@@ -15,4 +16,25 @@ class C2 {
|
||||
sink(s)
|
||||
}
|
||||
}
|
||||
|
||||
fun test2() {
|
||||
val l1 = arrayOf("")
|
||||
val l2 = arrayOf("")
|
||||
l1[0] = taint("a")
|
||||
l2.set(0, taint("a"))
|
||||
sink(l1[0])
|
||||
sink(l2[0])
|
||||
sink(l1.get(0))
|
||||
sink(l2.get(0))
|
||||
}
|
||||
|
||||
fun setWrapper(l: Array<String>, v: String) {
|
||||
l.set(0, v)
|
||||
}
|
||||
fun test3() {
|
||||
val l = arrayOf("")
|
||||
setWrapper(l, taint("a"))
|
||||
sink(l[0])
|
||||
sink(l.get(0))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,5 +4,12 @@
|
||||
| C1.java:10:44:10:46 | "a" | C1.java:19:20:19:20 | s |
|
||||
| C2.kt:8:31:8:33 | "a" | C2.kt:9:14:9:14 | l |
|
||||
| C2.kt:8:31:8:33 | "a" | C2.kt:10:14:10:17 | ...[...] |
|
||||
| C2.kt:8:31:8:33 | "a" | C2.kt:12:18:12:21 | ...[...] |
|
||||
| C2.kt:8:31:8:33 | "a" | C2.kt:15:18:15:18 | s |
|
||||
| C2.kt:8:31:8:33 | "a" | C2.kt:11:14:11:21 | get(...) |
|
||||
| C2.kt:8:31:8:33 | "a" | C2.kt:13:18:13:21 | ...[...] |
|
||||
| C2.kt:8:31:8:33 | "a" | C2.kt:16:18:16:18 | s |
|
||||
| C2.kt:23:23:23:25 | "a" | C2.kt:25:14:25:18 | ...[...] |
|
||||
| C2.kt:23:23:23:25 | "a" | C2.kt:27:14:27:22 | get(...) |
|
||||
| C2.kt:24:25:24:27 | "a" | C2.kt:26:14:26:18 | ...[...] |
|
||||
| C2.kt:24:25:24:27 | "a" | C2.kt:28:14:28:22 | get(...) |
|
||||
| C2.kt:36:29:36:31 | "a" | C2.kt:37:14:37:17 | ...[...] |
|
||||
| C2.kt:36:29:36:31 | "a" | C2.kt:38:14:38:21 | get(...) |
|
||||
|
||||
Reference in New Issue
Block a user