File tree Expand file tree Collapse file tree 3 files changed +48
-0
lines changed
java/ql/test/library-tests/dataflow/partial Expand file tree Collapse file tree 3 files changed +48
-0
lines changed Original file line number Diff line number Diff line change 1+ public class A {
2+ static void sink (Object o ) { }
3+
4+ static class Box {
5+ public Object elem ;
6+ }
7+
8+ static Object src () { return new Object (); }
9+
10+ Box f1 () {
11+ Box b = new Box ();
12+ b .elem = src ();
13+ return b ;
14+ }
15+
16+ void f2 () {
17+ Box b = f1 ();
18+ f3 (b );
19+ }
20+
21+ void f3 (Box b ) {
22+ Box other = new Box ();
23+ sink (other .elem );
24+ }
25+ }
Original file line number Diff line number Diff line change 1+ | 0 | A.java:12:5:12:5 | b [post update] [elem, ... (1)] |
2+ | 0 | A.java:12:5:12:18 | ...=... [Object] |
3+ | 0 | A.java:13:12:13:12 | b [elem, ... (1)] |
4+ | 1 | A.java:17:13:17:16 | f1(...) [elem, ... (1)] |
5+ | 1 | A.java:18:8:18:8 | b [elem, ... (1)] |
6+ | 2 | A.java:21:11:21:15 | b [elem, ... (1)] |
Original file line number Diff line number Diff line change 1+ import java
2+ import semmle.code.java.dataflow.DataFlow
3+ import DataFlow
4+
5+ class Conf extends Configuration {
6+ Conf ( ) { this = "partial flow" }
7+
8+ override predicate isSource ( Node n ) { n .asExpr ( ) .( MethodAccess ) .getMethod ( ) .hasName ( "src" ) }
9+
10+ override predicate isSink ( Node n ) { n .asExpr ( ) .( Argument ) .getCall ( ) .getCallee ( ) .hasName ( "sink" ) }
11+
12+ override int explorationLimit ( ) { result = 10 }
13+ }
14+
15+ from PartialPathNode n , int dist
16+ where any ( Conf c ) .hasPartialFlow ( _, n , dist )
17+ select dist , n
You can’t perform that action at this time.
0 commit comments