File tree Expand file tree Collapse file tree
java/ql/lib/semmle/code/java/dataflow
shared/typeflow/codeql/typeflow Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ private module Input implements TypeFlowInput<J::Location> {
125125 /**
126126 * Holds if `null` is the only value that flows to `n`.
127127 */
128- predicate isNull ( TypeFlowNode n ) {
128+ predicate isNullValue ( TypeFlowNode n ) {
129129 n .asExpr ( ) instanceof NullLiteral
130130 or
131131 exists ( LocalVariableDeclExpr decl |
@@ -134,9 +134,7 @@ private module Input implements TypeFlowInput<J::Location> {
134134 not exists ( decl .getInit ( ) )
135135 )
136136 or
137- exists ( TypeFlowNode mid | isNull ( mid ) and step ( mid , n ) )
138- or
139- forex ( TypeFlowNode mid | joinStep0 ( mid , n ) | isNull ( mid ) ) and
137+ forex ( TypeFlowNode mid | joinStep0 ( mid , n ) | Make< J:: Location , Input > :: isNull ( mid ) ) and
140138 // Fields that are never assigned a non-null value are probably set by
141139 // reflection and are thus not always null.
142140 not exists ( n .asField ( ) )
Original file line number Diff line number Diff line change @@ -39,10 +39,8 @@ signature module TypeFlowInput<LocationSig Location> {
3939 */
4040 predicate step ( TypeFlowNode n1 , TypeFlowNode n2 ) ;
4141
42- /**
43- * Holds if `null` is the only value that flows to `n`.
44- */
45- predicate isNull ( TypeFlowNode n ) ;
42+ /** Holds if `n` represents a `null` value. */
43+ predicate isNullValue ( TypeFlowNode n ) ;
4644
4745 /** A type. */
4846 class Type {
Original file line number Diff line number Diff line change @@ -5,6 +5,13 @@ private import codeql.util.Unit
55module TypeFlow< LocationSig Location, TypeFlowInput< Location > I> {
66 private import I
77
8+ /** Holds if `null` is the only value that flows to `n`. */
9+ predicate isNull ( TypeFlowNode n ) {
10+ isNullValue ( n )
11+ or
12+ exists ( TypeFlowNode mid | isNull ( mid ) and step ( mid , n ) )
13+ }
14+
815 /**
916 * Holds if data can flow from `n1` to `n2` in one step, `n1` is not necessarily
1017 * functionally determined by `n2`, and `n1` might take a non-null value.
You can’t perform that action at this time.
0 commit comments