@@ -1756,18 +1756,31 @@ private module LocalFlowBigStep {
1756
1756
* Holds if `node` can be the first node in a maximal subsequence of local
1757
1757
* flow steps in a dataflow path.
1758
1758
*/
1759
- predicate localFlowEntry ( NodeEx node , FlowState state , Configuration config ) {
1759
+ private predicate localFlowEntry ( NodeEx node , FlowState state , Configuration config ) {
1760
1760
Stage2:: revFlow ( node , state , config ) and
1761
1761
(
1762
- sourceNode ( node , state , config ) or
1763
- jumpStep ( _, node , config ) or
1764
- additionalJumpStep ( _, node , config ) or
1765
- additionalJumpStateStep ( _, _, node , state , config ) or
1766
- node instanceof ParamNodeEx or
1767
- node .asNode ( ) instanceof OutNodeExt or
1768
- store ( _, _, node , _, config ) or
1769
- read ( _, _, node , config ) or
1762
+ sourceNode ( node , state , config )
1763
+ or
1764
+ jumpStep ( _, node , config )
1765
+ or
1766
+ additionalJumpStep ( _, node , config )
1767
+ or
1768
+ additionalJumpStateStep ( _, _, node , state , config )
1769
+ or
1770
+ node instanceof ParamNodeEx
1771
+ or
1772
+ node .asNode ( ) instanceof OutNodeExt
1773
+ or
1774
+ store ( _, _, node , _, config )
1775
+ or
1776
+ read ( _, _, node , config )
1777
+ or
1770
1778
node instanceof FlowCheckNode
1779
+ or
1780
+ exists ( FlowState s |
1781
+ additionalLocalStateStep ( _, s , node , state , config ) and
1782
+ s != state
1783
+ )
1771
1784
)
1772
1785
}
1773
1786
@@ -1787,6 +1800,9 @@ private module LocalFlowBigStep {
1787
1800
or
1788
1801
exists ( NodeEx next , FlowState s | Stage2:: revFlow ( next , s , config ) |
1789
1802
additionalJumpStateStep ( node , state , next , s , config )
1803
+ or
1804
+ additionalLocalStateStep ( node , state , next , s , config ) and
1805
+ s != state
1790
1806
)
1791
1807
or
1792
1808
Stage2:: revFlow ( node , state , config ) and
@@ -1820,42 +1836,40 @@ private module LocalFlowBigStep {
1820
1836
*/
1821
1837
pragma [ nomagic]
1822
1838
private predicate localFlowStepPlus (
1823
- NodeEx node1 , FlowState state1 , NodeEx node2 , FlowState state2 , boolean preservesValue ,
1824
- DataFlowType t , Configuration config , LocalCallContext cc
1839
+ NodeEx node1 , FlowState state , NodeEx node2 , boolean preservesValue , DataFlowType t ,
1840
+ Configuration config , LocalCallContext cc
1825
1841
) {
1826
1842
not isUnreachableInCallCached ( node2 .asNode ( ) , cc .( LocalCallContextSpecificCall ) .getCall ( ) ) and
1827
1843
(
1828
- localFlowEntry ( node1 , pragma [ only_bind_into ] ( state1 ) , pragma [ only_bind_into ] ( config ) ) and
1844
+ localFlowEntry ( node1 , pragma [ only_bind_into ] ( state ) , pragma [ only_bind_into ] ( config ) ) and
1829
1845
(
1830
1846
localFlowStepNodeCand1 ( node1 , node2 , config ) and
1831
- state1 = state2 and
1832
1847
preservesValue = true and
1833
- t = node1 .getDataFlowType ( ) // irrelevant dummy value
1848
+ t = node1 .getDataFlowType ( ) and // irrelevant dummy value
1849
+ Stage2:: revFlow ( node2 , pragma [ only_bind_into ] ( state ) , pragma [ only_bind_into ] ( config ) )
1834
1850
or
1835
- additionalLocalFlowStepNodeCand2 ( node1 , state1 , node2 , state2 , config ) and
1851
+ additionalLocalFlowStepNodeCand2 ( node1 , state , node2 , state , config ) and
1836
1852
preservesValue = false and
1837
1853
t = node2 .getDataFlowType ( )
1838
1854
) and
1839
1855
node1 != node2 and
1840
1856
cc .relevantFor ( node1 .getEnclosingCallable ( ) ) and
1841
- not isUnreachableInCallCached ( node1 .asNode ( ) , cc .( LocalCallContextSpecificCall ) .getCall ( ) ) and
1842
- Stage2:: revFlow ( node2 , pragma [ only_bind_into ] ( state2 ) , pragma [ only_bind_into ] ( config ) )
1857
+ not isUnreachableInCallCached ( node1 .asNode ( ) , cc .( LocalCallContextSpecificCall ) .getCall ( ) )
1843
1858
or
1844
1859
exists ( NodeEx mid |
1845
- localFlowStepPlus ( node1 , state1 , mid , pragma [ only_bind_into ] ( state2 ) , preservesValue , t ,
1860
+ localFlowStepPlus ( node1 , pragma [ only_bind_into ] ( state ) , mid , preservesValue , t ,
1846
1861
pragma [ only_bind_into ] ( config ) , cc ) and
1847
1862
localFlowStepNodeCand1 ( mid , node2 , config ) and
1848
1863
not mid instanceof FlowCheckNode and
1849
- Stage2:: revFlow ( node2 , pragma [ only_bind_into ] ( state2 ) , pragma [ only_bind_into ] ( config ) )
1864
+ Stage2:: revFlow ( node2 , pragma [ only_bind_into ] ( state ) , pragma [ only_bind_into ] ( config ) )
1850
1865
)
1851
1866
or
1852
- exists ( NodeEx mid , FlowState st |
1853
- localFlowStepPlus ( node1 , state1 , mid , st , _, _, pragma [ only_bind_into ] ( config ) , cc ) and
1854
- additionalLocalFlowStepNodeCand2 ( mid , st , node2 , state2 , config ) and
1867
+ exists ( NodeEx mid |
1868
+ localFlowStepPlus ( node1 , state , mid , _, _, pragma [ only_bind_into ] ( config ) , cc ) and
1869
+ additionalLocalFlowStepNodeCand2 ( mid , state , node2 , state , config ) and
1855
1870
not mid instanceof FlowCheckNode and
1856
1871
preservesValue = false and
1857
- t = node2 .getDataFlowType ( ) and
1858
- Stage2:: revFlow ( node2 , state2 , pragma [ only_bind_into ] ( config ) )
1872
+ t = node2 .getDataFlowType ( )
1859
1873
)
1860
1874
)
1861
1875
}
@@ -1869,9 +1883,19 @@ private module LocalFlowBigStep {
1869
1883
NodeEx node1 , FlowState state1 , NodeEx node2 , FlowState state2 , boolean preservesValue ,
1870
1884
AccessPathFrontNil apf , Configuration config , LocalCallContext callContext
1871
1885
) {
1872
- localFlowStepPlus ( node1 , state1 , node2 , state2 , preservesValue , apf .getType ( ) , config ,
1873
- callContext ) and
1874
- localFlowExit ( node2 , state2 , config )
1886
+ localFlowStepPlus ( node1 , state1 , node2 , preservesValue , apf .getType ( ) , config , callContext ) and
1887
+ localFlowExit ( node2 , state1 , config ) and
1888
+ state1 = state2
1889
+ or
1890
+ additionalLocalFlowStepNodeCand2 ( node1 , state1 , node2 , state2 , config ) and
1891
+ state1 != state2 and
1892
+ preservesValue = false and
1893
+ apf = TFrontNil ( node2 .getDataFlowType ( ) ) and
1894
+ callContext .relevantFor ( node1 .getEnclosingCallable ( ) ) and
1895
+ not exists ( DataFlowCall call | call = callContext .( LocalCallContextSpecificCall ) .getCall ( ) |
1896
+ isUnreachableInCallCached ( node1 .asNode ( ) , call ) or
1897
+ isUnreachableInCallCached ( node2 .asNode ( ) , call )
1898
+ )
1875
1899
}
1876
1900
}
1877
1901
@@ -2745,10 +2769,10 @@ private module Stage4 {
2745
2769
2746
2770
bindingset [ node, cc, config]
2747
2771
private LocalCc getLocalCc ( NodeEx node , Cc cc , Configuration config ) {
2748
- localFlowEntry ( node , _, config ) and
2749
2772
result =
2750
2773
getLocalCallContext ( pragma [ only_bind_into ] ( pragma [ only_bind_out ] ( cc ) ) ,
2751
- node .getEnclosingCallable ( ) )
2774
+ node .getEnclosingCallable ( ) ) and
2775
+ exists ( config )
2752
2776
}
2753
2777
2754
2778
private predicate localStep (
0 commit comments