Skip to content

Commit 827e4d6

Browse files
committed
C++: Hide flow summary nodes from consistency just like Rust does.
1 parent 5f0c7f3 commit 827e4d6

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
private import cpp
77
private import DataFlowImplSpecific
88
private import TaintTrackingImplSpecific
9+
private import DataFlowNodes as Nodes
10+
private import semmle.code.cpp.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
911
private import codeql.dataflow.internal.DataFlowImplConsistency
1012

1113
private module Input implements InputSig<Location, CppDataFlow> {
@@ -14,6 +16,12 @@ private module Input implements InputSig<Location, CppDataFlow> {
1416
// complex to model here.
1517
any()
1618
}
19+
20+
predicate postWithInFlowExclude(CppDataFlow::Node n) {
21+
n instanceof Nodes::FlowSummaryNode
22+
or
23+
FlowSummaryImpl::Private::Steps::summaryLocalStep(_, n, _, _)
24+
}
1725
}
1826

1927
module Consistency = MakeConsistency<Location, CppDataFlow, CppTaintTracking, Input>;

cpp/ql/test/library-tests/dataflow/models-as-data/testModels.expected

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ postIsInSameCallable
1818
reverseRead
1919
argHasPostUpdate
2020
postWithInFlow
21-
| tests.cpp:60:30:60:31 | remoteMadSourceIndirectArg0 output argument | PostUpdateNode should not be the target of local flow. |
22-
| tests.cpp:63:33:63:33 | remoteMadSourceIndirectArg1 output argument | PostUpdateNode should not be the target of local flow. |
23-
| tests.cpp:295:39:295:40 | memberRemoteMadSourceIndirectArg0 output argument | PostUpdateNode should not be the target of local flow. |
24-
| tests.cpp:369:2:369:4 | qualifierSource output argument | PostUpdateNode should not be the target of local flow. |
2521
viableImplInCallContextTooLarge
2622
uniqueParameterNodeAtPosition
2723
uniqueParameterNodePosition

0 commit comments

Comments
 (0)