Kotlin: Add a test for dataflow with an Array.set wrapper

This commit is contained in:
Ian Lynagh
2023-12-06 12:19:25 +00:00
parent 66c0a4af5a
commit 7fc7b96ed7
2 changed files with 12 additions and 0 deletions

View File

@@ -27,4 +27,14 @@ class C2 {
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))
}
}

View File

@@ -11,3 +11,5 @@
| C2.kt:23:24:23:24 | "a" | C2.kt:27:14:27:22 | get(...) |
| C2.kt:24:26:24:26 | "a" | C2.kt:26:14:26:18 | ...[...] |
| C2.kt:24:26:24:26 | "a" | C2.kt:28:14:28:22 | get(...) |
| C2.kt:36:30:36:30 | "a" | C2.kt:37:14:37:17 | ...[...] |
| C2.kt:36:30:36:30 | "a" | C2.kt:38:14:38:21 | get(...) |