Skip to content

Commit c948efb

Browse files
committed
C#: Do not clear content of collection type struct fields.
1 parent 93d07a5 commit c948efb

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ private import ControlFlowReachability
66
private import FlowSummaryImpl as FlowSummaryImpl
77
private import semmle.code.csharp.dataflow.FlowSummary as FlowSummary
88
private import semmle.code.csharp.dataflow.internal.ExternalFlow
9+
private import semmle.code.csharp.commons.Collections
910
private import semmle.code.csharp.Conversion
1011
private import semmle.code.csharp.dataflow.internal.SsaImpl as SsaImpl
1112
private import semmle.code.csharp.ExprOrStmtParent
@@ -2528,6 +2529,7 @@ private predicate clearsCont(Node n, Content c) {
25282529
a.getType() = s and
25292530
f = s.getAField() and
25302531
c.(FieldContent).getField() = f.getUnboundDeclaration() and
2532+
not f.getType() instanceof CollectionType and
25312533
not f.isRef()
25322534
)
25332535
or

0 commit comments

Comments
 (0)