Skip to content

Commit 9630feb

Browse files
committed
Dataflow: Remove revFlowAlias trick
1 parent 540542c commit 9630feb

File tree

8 files changed

+80
-160
lines changed

8 files changed

+80
-160
lines changed

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,16 +1695,6 @@ module Impl<FullStateConfigSig Config> {
16951695
pragma[nomagic]
16961696
predicate revFlowAp(NodeEx node, Ap ap) { revFlow(node, _, _, _, ap) }
16971697

1698-
// use an alias as a workaround for bad functionality-induced joins
1699-
pragma[nomagic]
1700-
additional predicate revFlowAlias(NodeEx node) { revFlow(node, _, _, _, _) }
1701-
1702-
// use an alias as a workaround for bad functionality-induced joins
1703-
pragma[nomagic]
1704-
additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap) {
1705-
revFlow(node, state, ap)
1706-
}
1707-
17081698
private predicate fwdConsCand(TypedContent tc, Ap ap) { storeStepFwd(_, ap, tc, _, _) }
17091699

17101700
private predicate revConsCand(TypedContent tc, Ap ap) { storeStepCand(_, ap, tc, _, _) }
@@ -1978,7 +1968,7 @@ module Impl<FullStateConfigSig Config> {
19781968
) {
19791969
flowOutOfCallNodeCand1(call, node1, kind, node2, allowsFieldFlow) and
19801970
Stage2::revFlow(node2) and
1981-
Stage2::revFlowAlias(node1)
1971+
Stage2::revFlow(node1)
19821972
}
19831973

19841974
pragma[nomagic]
@@ -1987,7 +1977,7 @@ module Impl<FullStateConfigSig Config> {
19871977
) {
19881978
flowIntoCallNodeCand1(call, node1, node2, allowsFieldFlow) and
19891979
Stage2::revFlow(node2) and
1990-
Stage2::revFlowAlias(node1)
1980+
Stage2::revFlow(node1)
19911981
}
19921982

19931983
private module LocalFlowBigStep {
@@ -2069,11 +2059,11 @@ module Impl<FullStateConfigSig Config> {
20692059
additionalLocalFlowStepNodeCand1(node1, node2) and
20702060
state1 = state2 and
20712061
Stage2::revFlow(node1, pragma[only_bind_into](state1), false) and
2072-
Stage2::revFlowAlias(node2, pragma[only_bind_into](state2), false)
2062+
Stage2::revFlow(node2, pragma[only_bind_into](state2), false)
20732063
or
20742064
additionalLocalStateStep(node1, state1, node2, state2) and
20752065
Stage2::revFlow(node1, state1, false) and
2076-
Stage2::revFlowAlias(node2, state2, false)
2066+
Stage2::revFlow(node2, state2, false)
20772067
}
20782068

20792069
/**
@@ -2266,7 +2256,7 @@ module Impl<FullStateConfigSig Config> {
22662256
) {
22672257
localFlowBigStep(node1, state1, node2, state2, preservesValue, ap.getType(), _) and
22682258
PrevStage::revFlow(node1, pragma[only_bind_into](state1), _) and
2269-
PrevStage::revFlowAlias(node2, pragma[only_bind_into](state2), _) and
2259+
PrevStage::revFlow(node2, pragma[only_bind_into](state2), _) and
22702260
exists(lcc)
22712261
}
22722262

@@ -2277,7 +2267,7 @@ module Impl<FullStateConfigSig Config> {
22772267
exists(FlowState state |
22782268
flowOutOfCallNodeCand2(call, node1, kind, node2, allowsFieldFlow) and
22792269
PrevStage::revFlow(node2, pragma[only_bind_into](state), _) and
2280-
PrevStage::revFlowAlias(node1, pragma[only_bind_into](state), _)
2270+
PrevStage::revFlow(node1, pragma[only_bind_into](state), _)
22812271
)
22822272
}
22832273

@@ -2288,7 +2278,7 @@ module Impl<FullStateConfigSig Config> {
22882278
exists(FlowState state |
22892279
flowIntoCallNodeCand2(call, node1, node2, allowsFieldFlow) and
22902280
PrevStage::revFlow(node2, pragma[only_bind_into](state), _) and
2291-
PrevStage::revFlowAlias(node1, pragma[only_bind_into](state), _)
2281+
PrevStage::revFlow(node1, pragma[only_bind_into](state), _)
22922282
)
22932283
}
22942284

@@ -2590,7 +2580,7 @@ module Impl<FullStateConfigSig Config> {
25902580
) {
25912581
localFlowBigStep(node1, state1, node2, state2, preservesValue, ap.getType(), lcc) and
25922582
PrevStage::revFlow(node1, pragma[only_bind_into](state1), _) and
2593-
PrevStage::revFlowAlias(node2, pragma[only_bind_into](state2), _)
2583+
PrevStage::revFlow(node2, pragma[only_bind_into](state2), _)
25942584
}
25952585

25962586
pragma[nomagic]
@@ -2600,7 +2590,7 @@ module Impl<FullStateConfigSig Config> {
26002590
exists(FlowState state |
26012591
flowOutOfCallNodeCand2(call, node1, kind, node2, allowsFieldFlow) and
26022592
PrevStage::revFlow(node2, pragma[only_bind_into](state), _) and
2603-
PrevStage::revFlowAlias(node1, pragma[only_bind_into](state), _)
2593+
PrevStage::revFlow(node1, pragma[only_bind_into](state), _)
26042594
)
26052595
}
26062596

@@ -2611,7 +2601,7 @@ module Impl<FullStateConfigSig Config> {
26112601
exists(FlowState state |
26122602
flowIntoCallNodeCand2(call, node1, node2, allowsFieldFlow) and
26132603
PrevStage::revFlow(node2, pragma[only_bind_into](state), _) and
2614-
PrevStage::revFlowAlias(node1, pragma[only_bind_into](state), _)
2604+
PrevStage::revFlow(node1, pragma[only_bind_into](state), _)
26152605
)
26162606
}
26172607

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,16 +1695,6 @@ module Impl<FullStateConfigSig Config> {
16951695
pragma[nomagic]
16961696
predicate revFlowAp(NodeEx node, Ap ap) { revFlow(node, _, _, _, ap) }
16971697

1698-
// use an alias as a workaround for bad functionality-induced joins
1699-
pragma[nomagic]
1700-
additional predicate revFlowAlias(NodeEx node) { revFlow(node, _, _, _, _) }
1701-
1702-
// use an alias as a workaround for bad functionality-induced joins
1703-
pragma[nomagic]
1704-
additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap) {
1705-
revFlow(node, state, ap)
1706-
}
1707-
17081698
private predicate fwdConsCand(TypedContent tc, Ap ap) { storeStepFwd(_, ap, tc, _, _) }
17091699

17101700
private predicate revConsCand(TypedContent tc, Ap ap) { storeStepCand(_, ap, tc, _, _) }
@@ -1978,7 +1968,7 @@ module Impl<FullStateConfigSig Config> {
19781968
) {
19791969
flowOutOfCallNodeCand1(call, node1, kind, node2, allowsFieldFlow) and
19801970
Stage2::revFlow(node2) and
1981-
Stage2::revFlowAlias(node1)
1971+
Stage2::revFlow(node1)
19821972
}
19831973

19841974
pragma[nomagic]
@@ -1987,7 +1977,7 @@ module Impl<FullStateConfigSig Config> {
19871977
) {
19881978
flowIntoCallNodeCand1(call, node1, node2, allowsFieldFlow) and
19891979
Stage2::revFlow(node2) and
1990-
Stage2::revFlowAlias(node1)
1980+
Stage2::revFlow(node1)
19911981
}
19921982

19931983
private module LocalFlowBigStep {
@@ -2069,11 +2059,11 @@ module Impl<FullStateConfigSig Config> {
20692059
additionalLocalFlowStepNodeCand1(node1, node2) and
20702060
state1 = state2 and
20712061
Stage2::revFlow(node1, pragma[only_bind_into](state1), false) and
2072-
Stage2::revFlowAlias(node2, pragma[only_bind_into](state2), false)
2062+
Stage2::revFlow(node2, pragma[only_bind_into](state2), false)
20732063
or
20742064
additionalLocalStateStep(node1, state1, node2, state2) and
20752065
Stage2::revFlow(node1, state1, false) and
2076-
Stage2::revFlowAlias(node2, state2, false)
2066+
Stage2::revFlow(node2, state2, false)
20772067
}
20782068

20792069
/**
@@ -2266,7 +2256,7 @@ module Impl<FullStateConfigSig Config> {
22662256
) {
22672257
localFlowBigStep(node1, state1, node2, state2, preservesValue, ap.getType(), _) and
22682258
PrevStage::revFlow(node1, pragma[only_bind_into](state1), _) and
2269-
PrevStage::revFlowAlias(node2, pragma[only_bind_into](state2), _) and
2259+
PrevStage::revFlow(node2, pragma[only_bind_into](state2), _) and
22702260
exists(lcc)
22712261
}
22722262

@@ -2277,7 +2267,7 @@ module Impl<FullStateConfigSig Config> {
22772267
exists(FlowState state |
22782268
flowOutOfCallNodeCand2(call, node1, kind, node2, allowsFieldFlow) and
22792269
PrevStage::revFlow(node2, pragma[only_bind_into](state), _) and
2280-
PrevStage::revFlowAlias(node1, pragma[only_bind_into](state), _)
2270+
PrevStage::revFlow(node1, pragma[only_bind_into](state), _)
22812271
)
22822272
}
22832273

@@ -2288,7 +2278,7 @@ module Impl<FullStateConfigSig Config> {
22882278
exists(FlowState state |
22892279
flowIntoCallNodeCand2(call, node1, node2, allowsFieldFlow) and
22902280
PrevStage::revFlow(node2, pragma[only_bind_into](state), _) and
2291-
PrevStage::revFlowAlias(node1, pragma[only_bind_into](state), _)
2281+
PrevStage::revFlow(node1, pragma[only_bind_into](state), _)
22922282
)
22932283
}
22942284

@@ -2590,7 +2580,7 @@ module Impl<FullStateConfigSig Config> {
25902580
) {
25912581
localFlowBigStep(node1, state1, node2, state2, preservesValue, ap.getType(), lcc) and
25922582
PrevStage::revFlow(node1, pragma[only_bind_into](state1), _) and
2593-
PrevStage::revFlowAlias(node2, pragma[only_bind_into](state2), _)
2583+
PrevStage::revFlow(node2, pragma[only_bind_into](state2), _)
25942584
}
25952585

25962586
pragma[nomagic]
@@ -2600,7 +2590,7 @@ module Impl<FullStateConfigSig Config> {
26002590
exists(FlowState state |
26012591
flowOutOfCallNodeCand2(call, node1, kind, node2, allowsFieldFlow) and
26022592
PrevStage::revFlow(node2, pragma[only_bind_into](state), _) and
2603-
PrevStage::revFlowAlias(node1, pragma[only_bind_into](state), _)
2593+
PrevStage::revFlow(node1, pragma[only_bind_into](state), _)
26042594
)
26052595
}
26062596

@@ -2611,7 +2601,7 @@ module Impl<FullStateConfigSig Config> {
26112601
exists(FlowState state |
26122602
flowIntoCallNodeCand2(call, node1, node2, allowsFieldFlow) and
26132603
PrevStage::revFlow(node2, pragma[only_bind_into](state), _) and
2614-
PrevStage::revFlowAlias(node1, pragma[only_bind_into](state), _)
2604+
PrevStage::revFlow(node1, pragma[only_bind_into](state), _)
26152605
)
26162606
}
26172607

csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,16 +1695,6 @@ module Impl<FullStateConfigSig Config> {
16951695
pragma[nomagic]
16961696
predicate revFlowAp(NodeEx node, Ap ap) { revFlow(node, _, _, _, ap) }
16971697

1698-
// use an alias as a workaround for bad functionality-induced joins
1699-
pragma[nomagic]
1700-
additional predicate revFlowAlias(NodeEx node) { revFlow(node, _, _, _, _) }
1701-
1702-
// use an alias as a workaround for bad functionality-induced joins
1703-
pragma[nomagic]
1704-
additional predicate revFlowAlias(NodeEx node, FlowState state, Ap ap) {
1705-
revFlow(node, state, ap)
1706-
}
1707-
17081698
private predicate fwdConsCand(TypedContent tc, Ap ap) { storeStepFwd(_, ap, tc, _, _) }
17091699

17101700
private predicate revConsCand(TypedContent tc, Ap ap) { storeStepCand(_, ap, tc, _, _) }
@@ -1978,7 +1968,7 @@ module Impl<FullStateConfigSig Config> {
19781968
) {
19791969
flowOutOfCallNodeCand1(call, node1, kind, node2, allowsFieldFlow) and
19801970
Stage2::revFlow(node2) and
1981-
Stage2::revFlowAlias(node1)
1971+
Stage2::revFlow(node1)
19821972
}
19831973

19841974
pragma[nomagic]
@@ -1987,7 +1977,7 @@ module Impl<FullStateConfigSig Config> {
19871977
) {
19881978
flowIntoCallNodeCand1(call, node1, node2, allowsFieldFlow) and
19891979
Stage2::revFlow(node2) and
1990-
Stage2::revFlowAlias(node1)
1980+
Stage2::revFlow(node1)
19911981
}
19921982

19931983
private module LocalFlowBigStep {
@@ -2069,11 +2059,11 @@ module Impl<FullStateConfigSig Config> {
20692059
additionalLocalFlowStepNodeCand1(node1, node2) and
20702060
state1 = state2 and
20712061
Stage2::revFlow(node1, pragma[only_bind_into](state1), false) and
2072-
Stage2::revFlowAlias(node2, pragma[only_bind_into](state2), false)
2062+
Stage2::revFlow(node2, pragma[only_bind_into](state2), false)
20732063
or
20742064
additionalLocalStateStep(node1, state1, node2, state2) and
20752065
Stage2::revFlow(node1, state1, false) and
2076-
Stage2::revFlowAlias(node2, state2, false)
2066+
Stage2::revFlow(node2, state2, false)
20772067
}
20782068

20792069
/**
@@ -2266,7 +2256,7 @@ module Impl<FullStateConfigSig Config> {
22662256
) {
22672257
localFlowBigStep(node1, state1, node2, state2, preservesValue, ap.getType(), _) and
22682258
PrevStage::revFlow(node1, pragma[only_bind_into](state1), _) and
2269-
PrevStage::revFlowAlias(node2, pragma[only_bind_into](state2), _) and
2259+
PrevStage::revFlow(node2, pragma[only_bind_into](state2), _) and
22702260
exists(lcc)
22712261
}
22722262

@@ -2277,7 +2267,7 @@ module Impl<FullStateConfigSig Config> {
22772267
exists(FlowState state |
22782268
flowOutOfCallNodeCand2(call, node1, kind, node2, allowsFieldFlow) and
22792269
PrevStage::revFlow(node2, pragma[only_bind_into](state), _) and
2280-
PrevStage::revFlowAlias(node1, pragma[only_bind_into](state), _)
2270+
PrevStage::revFlow(node1, pragma[only_bind_into](state), _)
22812271
)
22822272
}
22832273

@@ -2288,7 +2278,7 @@ module Impl<FullStateConfigSig Config> {
22882278
exists(FlowState state |
22892279
flowIntoCallNodeCand2(call, node1, node2, allowsFieldFlow) and
22902280
PrevStage::revFlow(node2, pragma[only_bind_into](state), _) and
2291-
PrevStage::revFlowAlias(node1, pragma[only_bind_into](state), _)
2281+
PrevStage::revFlow(node1, pragma[only_bind_into](state), _)
22922282
)
22932283
}
22942284

@@ -2590,7 +2580,7 @@ module Impl<FullStateConfigSig Config> {
25902580
) {
25912581
localFlowBigStep(node1, state1, node2, state2, preservesValue, ap.getType(), lcc) and
25922582
PrevStage::revFlow(node1, pragma[only_bind_into](state1), _) and
2593-
PrevStage::revFlowAlias(node2, pragma[only_bind_into](state2), _)
2583+
PrevStage::revFlow(node2, pragma[only_bind_into](state2), _)
25942584
}
25952585

25962586
pragma[nomagic]
@@ -2600,7 +2590,7 @@ module Impl<FullStateConfigSig Config> {
26002590
exists(FlowState state |
26012591
flowOutOfCallNodeCand2(call, node1, kind, node2, allowsFieldFlow) and
26022592
PrevStage::revFlow(node2, pragma[only_bind_into](state), _) and
2603-
PrevStage::revFlowAlias(node1, pragma[only_bind_into](state), _)
2593+
PrevStage::revFlow(node1, pragma[only_bind_into](state), _)
26042594
)
26052595
}
26062596

@@ -2611,7 +2601,7 @@ module Impl<FullStateConfigSig Config> {
26112601
exists(FlowState state |
26122602
flowIntoCallNodeCand2(call, node1, node2, allowsFieldFlow) and
26132603
PrevStage::revFlow(node2, pragma[only_bind_into](state), _) and
2614-
PrevStage::revFlowAlias(node1, pragma[only_bind_into](state), _)
2604+
PrevStage::revFlow(node1, pragma[only_bind_into](state), _)
26152605
)
26162606
}
26172607

0 commit comments

Comments
 (0)