C#: Prevent flow out of non ref fields in ref structs used as arguments.

This commit is contained in:
Michael Nebel
2024-02-01 13:04:12 +01:00
parent 4a89cbe8ea
commit 9191acc412

View File

@@ -2017,6 +2017,14 @@ predicate clearsContent(Node n, ContentSet c) {
f = oi.getAMemberInitializer().getInitializedMember() and
c = f.getContent()
)
or
exists(Argument a, Struct s, Field f |
a = n.(PostUpdateNode).getPreUpdateNode().asExpr() and
a.getType() = s and
f = s.getAField() and
c.(FieldContent).getField() = f.getUnboundDeclaration() and
not f.isRef()
)
}
/**