File tree Expand file tree Collapse file tree 1 file changed +19
-1
lines changed
javascript/ql/lib/semmle/javascript/dataflow/internal Expand file tree Collapse file tree 1 file changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -1032,14 +1032,32 @@ private predicate isBlockedLegacyNode(Node node) {
10321032 legacyBarrier ( node )
10331033}
10341034
1035+ /**
1036+ * Holds if `thisNode` represents a value of `this` that is being tracked by the
1037+ * variable capture library.
1038+ *
1039+ * In this case we need to suppress the default flow steps between `thisNode` and
1040+ * the `ThisExpr` nodes; especially those that would become jump steps.
1041+ *
1042+ * Note that local uses of `this` are sometimes tracked by the local SSA library, but we should
1043+ * not block local def-use flow, since we only switch to use-use flow after a post-update.
1044+ */
1045+ pragma [ nomagic]
1046+ private predicate isThisNodeTrackedByVariableCapture ( DataFlow:: ThisNode thisNode ) {
1047+ exists ( StmtContainer container | thisNode = TThisNode ( container ) |
1048+ any ( VariableCaptureConfig:: CapturedVariable v ) .asThisContainer ( ) = container
1049+ )
1050+ }
1051+
10351052/**
10361053 * Holds if there is a value-preserving steps `node1` -> `node2` that might
10371054 * be cross function boundaries.
10381055 */
10391056private predicate valuePreservingStep ( Node node1 , Node node2 ) {
10401057 node1 .getASuccessor ( ) = node2 and
10411058 not isBlockedLegacyNode ( node1 ) and
1042- not isBlockedLegacyNode ( node2 )
1059+ not isBlockedLegacyNode ( node2 ) and
1060+ not isThisNodeTrackedByVariableCapture ( node1 )
10431061 or
10441062 FlowSteps:: propertyFlowStep ( node1 , node2 )
10451063 or
You can’t perform that action at this time.
0 commit comments