File tree Expand file tree Collapse file tree 3 files changed +44
-0
lines changed
java/ql/test/kotlin/library-tests/dataflow/summaries Expand file tree Collapse file tree 3 files changed +44
-0
lines changed Original file line number Diff line number Diff line change 1+ class ListFlowTest {
2+ fun <T > taint (t : T ) = t
3+ fun sink (a : Any ) {}
4+
5+ fun test (l : MutableList <String >) {
6+ l[0 ] = taint(" a" )
7+ sink(l)
8+ sink(l[0 ])
9+ for (s in l) {
10+ sink(s)
11+ }
12+
13+ val a = arrayOf(taint(" a" ), " b" )
14+ sink(a)
15+ sink(a[0 ])
16+ for (s in a) {
17+ sink(s)
18+ }
19+ }
20+ }
Original file line number Diff line number Diff line change 1+ | list.kt:6:23:6:23 | a | list.kt:7:14:7:14 | l |
2+ | list.kt:6:23:6:23 | a | list.kt:8:14:8:17 | get(...) |
3+ | list.kt:13:32:13:32 | a | list.kt:14:14:14:14 | a |
4+ | list.kt:13:32:13:32 | a | list.kt:15:14:15:17 | ...[...] |
5+ | list.kt:13:32:13:32 | a | list.kt:17:18:17:18 | s |
Original file line number Diff line number Diff line change 1+ import java
2+ import semmle.code.java.dataflow.TaintTracking
3+ import semmle.code.java.dataflow.ExternalFlow
4+
5+ class Conf extends TaintTracking:: Configuration {
6+ Conf ( ) { this = "qltest:mad-summaries" }
7+
8+ override predicate isSource ( DataFlow:: Node n ) {
9+ n .asExpr ( ) .( Argument ) .getCall ( ) .getCallee ( ) .hasName ( "taint" )
10+ }
11+
12+ override predicate isSink ( DataFlow:: Node n ) {
13+ n .asExpr ( ) .( Argument ) .getCall ( ) .getCallee ( ) .hasName ( "sink" )
14+ }
15+ }
16+
17+ from DataFlow:: Node src , DataFlow:: Node sink , Conf conf
18+ where conf .hasFlow ( src , sink )
19+ select src , sink
You can’t perform that action at this time.
0 commit comments