Skip to content

Commit b8b38e4

Browse files
committed
Java: Allow flow out of FieldValueNodes for non-static fields
1 parent aedd073 commit b8b38e4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

java/ql/lib/semmle/code/java/dataflow/internal/DataFlowPrivate.qll

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,17 +33,17 @@ OutNode getAnOutNode(DataFlowCall call, ReturnKind kind) {
3333
}
3434

3535
/**
36-
* Holds if data can flow from `node1` to `node2` through a static field.
36+
* Holds if data can flow from `node1` to `node2` through a field.
3737
*/
38-
private predicate staticFieldStep(Node node1, Node node2) {
38+
private predicate fieldStep(Node node1, Node node2) {
3939
exists(Field f |
40+
// Taint fields through assigned values only if they're static
4041
f.isStatic() and
4142
f.getAnAssignedValue() = node1.asExpr() and
4243
node2.(FieldValueNode).getField() = f
4344
)
4445
or
4546
exists(Field f, FieldRead fr |
46-
f.isStatic() and
4747
node1.(FieldValueNode).getField() = f and
4848
fr.getField() = f and
4949
fr = node2.asExpr() and
@@ -72,11 +72,11 @@ private predicate variableCaptureStep(Node node1, ExprNode node2) {
7272
}
7373

7474
/**
75-
* Holds if data can flow from `node1` to `node2` through a static field or
75+
* Holds if data can flow from `node1` to `node2` through a field or
7676
* variable capture.
7777
*/
7878
predicate jumpStep(Node node1, Node node2) {
79-
staticFieldStep(node1, node2)
79+
fieldStep(node1, node2)
8080
or
8181
variableCaptureStep(node1, node2)
8282
or

0 commit comments

Comments
 (0)