Skip to content

Commit

Permalink
Kotlin: Add a test for dataflow with an Array.set wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
igfoo committed Dec 6, 2023
1 parent 66c0a4a commit 7fc7b96
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
10 changes: 10 additions & 0 deletions java/ql/test-kotlin1/library-tests/dataflow/foreach/C2.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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(...) |

0 comments on commit 7fc7b96

Please sign in to comment.