Add dataflow test for property reference being used as lambda

This commit is contained in:
Tamas Vajk
2022-03-18 14:19:58 +01:00
committed by Ian Lynagh
parent 257224aa59
commit f12bcc5715
3 changed files with 10 additions and 0 deletions

View File

@@ -10,5 +10,10 @@ class FunctionReference {
Helper.sink(Processor().process(this::fn1, Helper.notaint()))
Helper.sink(Processor().process(::fn2, Helper.taint()))
Helper.sink(Processor().process(::fn2, Helper.notaint()))
Helper.sink(Processor().process(this::prop))
}
val prop: String
get() = Helper.taint()
}

View File

@@ -1,6 +1,7 @@
| functionReference.kt:8:59:8:65 | taint(...) | functionReference.kt:8:33:8:66 | process(...) |
| functionReference.kt:9:78:9:84 | taint(...) | functionReference.kt:9:33:9:85 | process(...) |
| functionReference.kt:11:55:11:61 | taint(...) | functionReference.kt:11:33:11:62 | process(...) |
| functionReference.kt:18:24:18:30 | taint(...) | functionReference.kt:14:33:14:51 | process(...) |
| lambda.kt:4:64:4:70 | taint(...) | lambda.kt:4:33:4:77 | process(...) |
| lambda.kt:5:60:5:66 | taint(...) | lambda.kt:5:33:5:67 | process(...) |
| lambda.kt:6:69:6:75 | taint(...) | lambda.kt:6:33:6:76 | process(...) |

View File

@@ -1,4 +1,8 @@
class Processor {
fun <R> process(f: () -> R) : R {
return f()
}
fun <T, R> process(f: (T) -> R, arg: T) : R {
return f(arg)
}