7171private import javascript
7272private import internal.FlowSteps
7373private import internal.AccessPaths
74+ private import internal.CallGraphs
7475
7576/**
7677 * A data flow tracking configuration for finding inter-procedural paths from
@@ -620,10 +621,11 @@ private predicate exploratoryFlowStep(
620621 isAdditionalStoreStep ( pred , succ , _, cfg ) or
621622 isAdditionalLoadStep ( pred , succ , _, cfg ) or
622623 isAdditionalLoadStoreStep ( pred , succ , _, cfg ) or
623- // the following two disjuncts taken together over-approximate flow through
624+ // the following three disjuncts taken together over-approximate flow through
624625 // higher-order calls
625626 callback ( pred , succ ) or
626- succ = pred .( DataFlow:: FunctionNode ) .getAParameter ( )
627+ succ = pred .( DataFlow:: FunctionNode ) .getAParameter ( ) or
628+ exploratoryBoundInvokeStep ( pred , succ )
627629}
628630
629631/**
@@ -751,7 +753,7 @@ private predicate flowThroughCall(
751753) {
752754 exists ( Function f , DataFlow:: ValueNode ret |
753755 ret .asExpr ( ) = f .getAReturnedExpr ( ) and
754- calls ( output , f ) and // Do not consider partial calls
756+ ( calls ( output , f ) or callsBound ( output , f , _ ) ) and // Do not consider partial calls
755757 reachableFromInput ( f , output , input , ret , cfg , summary ) and
756758 not isBarrierEdge ( cfg , ret , output ) and
757759 not isLabeledBarrierEdge ( cfg , ret , output , summary .getEndLabel ( ) ) and
@@ -761,7 +763,7 @@ private predicate flowThroughCall(
761763 exists ( Function f , DataFlow:: Node invk , DataFlow:: Node ret |
762764 DataFlow:: exceptionalFunctionReturnNode ( ret , f ) and
763765 DataFlow:: exceptionalInvocationReturnNode ( output , invk .asExpr ( ) ) and
764- calls ( invk , f ) and
766+ ( calls ( invk , f ) or callsBound ( invk , f , _ ) ) and
765767 reachableFromInput ( f , invk , input , ret , cfg , summary ) and
766768 not isBarrierEdge ( cfg , ret , output ) and
767769 not isLabeledBarrierEdge ( cfg , ret , output , summary .getEndLabel ( ) ) and
@@ -1032,6 +1034,13 @@ private predicate flowIntoHigherOrderCall(
10321034 succ = cb .getParameter ( i ) and
10331035 summary = oldSummary .append ( PathSummary:: call ( ) )
10341036 )
1037+ or
1038+ exists ( DataFlow:: SourceNode cb , DataFlow:: FunctionNode f , int i , int boundArgs , PathSummary oldSummary |
1039+ higherOrderCall ( pred , cb , i , cfg , oldSummary ) and
1040+ cb = CallGraph:: getABoundFunctionReference ( f , boundArgs , false ) and
1041+ succ = f .getParameter ( boundArgs + i ) and
1042+ summary = oldSummary .append ( PathSummary:: call ( ) )
1043+ )
10351044}
10361045
10371046/**
0 commit comments