@@ -104,11 +104,10 @@ predicate allBackslashesEscaped(DataFlow::Node node) {
104104 allBackslashesEscaped ( node .getAPredecessor ( ) )
105105 or
106106 // general data flow from a (destructive) [g]sub!
107- exists ( DataFlow :: PostUpdateNode post , StringSubstitutionCall sub |
107+ exists ( StringSubstitutionCall sub |
108108 sub .isDestructive ( ) and
109109 allBackslashesEscaped ( sub ) and
110- post .getPreUpdateNode ( ) = sub .getReceiver ( ) and
111- post .getASuccessor ( ) = node
110+ node .( DataFlow:: PostUpdateNode ) .getPreUpdateNode ( ) = sub .getReceiver ( )
112111 )
113112}
114113
@@ -125,19 +124,18 @@ predicate removesFirstOccurrence(StringSubstitutionCall sub, string str) {
125124 * call.
126125 */
127126DataFlow:: CallNode getAMethodCall ( StringSubstitutionCall call ) {
128- exists ( DataFlow:: Node receiver |
129- receiver = result .getReceiver ( ) and
130- (
131- // for a non-destructive string substitution, is there flow from it to the
132- // receiver of another method call?
133- not call .isDestructive ( ) and call .( DataFlow:: LocalSourceNode ) .flowsTo ( receiver )
134- or
135- // for a destructive string substitution, is there flow from its
136- // post-update receiver to the receiver of another method call?
137- call .isDestructive ( ) and
138- exists ( DataFlow:: PostUpdateNode post | post .getPreUpdateNode ( ) = call .getReceiver ( ) |
139- post .( DataFlow:: LocalSourceNode ) .flowsTo ( receiver )
140- )
127+ exists ( DataFlow:: Node receiver | receiver = result .getReceiver ( ) |
128+ // for a non-destructive string substitution, is there flow from it to the
129+ // receiver of another method call?
130+ not call .isDestructive ( ) and
131+ DataFlow:: localFlow ( call , receiver )
132+ or
133+ // for a destructive string substitution, is there flow from its
134+ // post-update receiver to the receiver of another method call?
135+ call .isDestructive ( ) and
136+ exists ( DataFlow:: PostUpdateNode post |
137+ post .getPreUpdateNode ( ) = call .getReceiver ( ) and
138+ DataFlow:: localFlowStep + ( post , receiver )
141139 )
142140 )
143141}
0 commit comments