File tree Expand file tree Collapse file tree
java/ql/test/library-tests/pattern-switch/dfg Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ | GuardTest.java:6:27:6:34 | o | GuardTest.java:11:14:11:14 | s |
12| Test.java:11:23:11:25 | "A" | Test.java:15:14:15:20 | get(...) |
23| Test.java:11:23:11:25 | "A" | Test.java:25:24:25:30 | get(...) |
34| Test.java:11:23:11:25 | "A" | Test.java:32:20:32:26 | get(...) |
Original file line number Diff line number Diff line change 11import java
22
3+ import semmle.code.java.controlflow.Guards
34import semmle.code.java.dataflow.DataFlow
45
6+ private predicate isSafe ( Guard g , Expr checked , boolean branch ) {
7+ exists ( MethodCall mc | g = mc |
8+ mc .getMethod ( ) .hasName ( "isSafe" ) and
9+ checked = mc .getAnArgument ( ) and
10+ branch = true
11+ )
12+ }
13+
514module TestConfig implements DataFlow:: ConfigSig {
6- predicate isSource ( DataFlow:: Node source ) { source .asExpr ( ) instanceof StringLiteral }
15+ predicate isSource ( DataFlow:: Node source ) { source .asExpr ( ) instanceof StringLiteral or source . asParameter ( ) . getCallable ( ) . hasName ( "test" ) }
716
817 predicate isSink ( DataFlow:: Node sink ) { sink .asExpr ( ) = any ( MethodCall mc | mc .getMethod ( ) .getName ( ) = "sink" ) .getAnArgument ( ) }
18+
19+ predicate isBarrier ( DataFlow:: Node node ) {
20+ node = DataFlow:: BarrierGuard< isSafe / 3 > :: getABarrierNode ( )
21+ }
922}
1023
1124module Flow = DataFlow:: Global< TestConfig > ;
You can’t perform that action at this time.
0 commit comments