@@ -7,6 +7,7 @@ private import FlowSummaryImpl as FlowSummaryImpl
77private import semmle.code.csharp.dataflow.FlowSummary as FlowSummary
88private import semmle.code.csharp.dataflow.internal.ExternalFlow
99private import semmle.code.csharp.Conversion
10+ private import semmle.code.csharp.exprs.internal.Expr
1011private import semmle.code.csharp.dataflow.internal.SsaImpl as SsaImpl
1112private import semmle.code.csharp.ExprOrStmtParent
1213private import semmle.code.csharp.Unification
@@ -2377,6 +2378,15 @@ predicate storeStep(Node node1, ContentSet c, Node node2) {
23772378 storeStepDelegateCall ( node1 , c , node2 )
23782379}
23792380
2381+ private predicate isAssignExprLValue ( Expr e ) {
2382+ e = any ( AssignExpr ae ) .getLValue ( )
2383+ or
2384+ exists ( Expr parent |
2385+ isAssignExprLValue ( parent ) and
2386+ e = parent .getAChildExpr ( )
2387+ )
2388+ }
2389+
23802390private class ReadStepConfiguration extends ControlFlowReachabilityConfiguration {
23812391 ReadStepConfiguration ( ) { this = "ReadStepConfiguration" }
23822392
@@ -2432,7 +2442,7 @@ private class ReadStepConfiguration extends ControlFlowReachabilityConfiguration
24322442 scope =
24332443 any ( AssignExpr ae |
24342444 ae = defTo .( AssignableDefinitions:: TupleAssignmentDefinition ) .getAssignment ( ) and
2435- e = ae . getLValue ( ) . getAChildExpr * ( ) . ( TupleExpr ) and
2445+ isAssignExprLValue ( e . ( TupleExpr ) ) and
24362446 exactScope = false and
24372447 isSuccessor = true
24382448 )
@@ -2488,7 +2498,7 @@ private predicate readContentStep(Node node1, Content c, Node node2) {
24882498 )
24892499 or
24902500 // item = variable in node1 = (..., variable, ...) in a case/is var (..., ...)
2491- te = any ( PatternExpr pe ) . getAChildExpr * ( ) and
2501+ isPatternExprAncestor ( te ) and
24922502 exists ( AssignableDefinitions:: LocalVariableDefinition lvd |
24932503 node2 .( AssignableDefinitionNode ) .getDefinition ( ) = lvd and
24942504 lvd .getDeclaration ( ) = item and
0 commit comments