File tree Expand file tree Collapse file tree 3 files changed +11
-8
lines changed
java/ql/lib/semmle/code/java/dataflow
shared/typeflow/codeql/typeflow Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -125,7 +125,7 @@ private module Input implements TypeFlowInput<J::Location> {
125
125
/**
126
126
* Holds if `null` is the only value that flows to `n`.
127
127
*/
128
- predicate isNull ( TypeFlowNode n ) {
128
+ predicate isNullValue ( TypeFlowNode n ) {
129
129
n .asExpr ( ) instanceof NullLiteral
130
130
or
131
131
exists ( LocalVariableDeclExpr decl |
@@ -134,9 +134,7 @@ private module Input implements TypeFlowInput<J::Location> {
134
134
not exists ( decl .getInit ( ) )
135
135
)
136
136
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
140
138
// Fields that are never assigned a non-null value are probably set by
141
139
// reflection and are thus not always null.
142
140
not exists ( n .asField ( ) )
Original file line number Diff line number Diff line change @@ -39,10 +39,8 @@ signature module TypeFlowInput<LocationSig Location> {
39
39
*/
40
40
predicate step ( TypeFlowNode n1 , TypeFlowNode n2 ) ;
41
41
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 ) ;
46
44
47
45
/** A type. */
48
46
class Type {
Original file line number Diff line number Diff line change @@ -5,6 +5,13 @@ private import codeql.util.Unit
5
5
module TypeFlow< LocationSig Location, TypeFlowInput< Location > I> {
6
6
private import I
7
7
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
+
8
15
/**
9
16
* Holds if data can flow from `n1` to `n2` in one step, `n1` is not necessarily
10
17
* functionally determined by `n2`, and `n1` might take a non-null value.
You can’t perform that action at this time.
0 commit comments