mirror of
https://github.com/github/codeql.git
synced 2026-05-01 11:45:14 +02:00
C#: Prevent flow out of non ref fields in ref structs used as arguments.
This commit is contained in:
@@ -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()
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user