Merge pull request #16500 from aschackmull/java/static-field-side-effect

Java: Add support for flow through side-effects on static fields.
This commit is contained in:
Anders Schack-Mulligen
2024-05-24 09:19:31 +02:00
committed by GitHub
4 changed files with 31 additions and 1 deletions

View File

@@ -0,0 +1,4 @@
---
category: majorAnalysis
---
* Added support for data flow through side-effects on static fields. For example, when a static field containing an array is updated.

View File

@@ -40,8 +40,11 @@ private predicate fieldStep(Node node1, Node node2) {
exists(Field f |
// Taint fields through assigned values only if they're static
f.isStatic() and
f.getAnAssignedValue() = node1.asExpr() and
node2.(FieldValueNode).getField() = f
|
f.getAnAssignedValue() = node1.asExpr()
or
f.getAnAccess() = node1.(PostUpdateNode).getPreUpdateNode().asExpr()
)
or
exists(Field f, FieldRead fr |