Skip to content

Commit 63c06b7

Browse files
committed
C#: Chop dataflow of spread into smaller steps and make sure to only propagate element flow for the spread operator.
1 parent b6f94ea commit 63c06b7

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,12 @@ module LocalFlow {
250250
scope = e2 and
251251
isSuccessor = true
252252
or
253-
e1 = e2.(CollectionExpression).getAnElement().(SpreadElementExpr).getExpr() and
253+
e1 = e2.(CollectionExpression).getAnElement() and
254+
e1 instanceof SpreadElementExpr and
255+
scope = e2 and
256+
isSuccessor = true
257+
or
258+
e1 = e2.(SpreadElementExpr).getExpr() and
254259
scope = e2 and
255260
isSuccessor = true
256261
or
@@ -2018,6 +2023,8 @@ predicate clearsContent(Node n, ContentSet c) {
20182023
*/
20192024
predicate expectsContent(Node n, ContentSet c) {
20202025
FlowSummaryImpl::Private::Steps::summaryExpectsContent(n.(FlowSummaryNode).getSummaryNode(), c)
2026+
or
2027+
n.asExpr() instanceof SpreadElementExpr and c instanceof ElementContent
20212028
}
20222029

20232030
/**

0 commit comments

Comments
 (0)