Skip to content

Commit 699630a

Browse files
committed
Dataflow: Sync.
1 parent 92e4a1e commit 699630a

28 files changed

+316
-4
lines changed

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3459,6 +3459,16 @@ private class PathNodeMid extends PathNodeImpl, TPathNodeMid {
34593459
ap instanceof AccessPathNil and
34603460
if hasSinkCallCtx(config)
34613461
then
3462+
// For `FeatureHasSinkCallContext` the condition `cc instanceof CallContextNoCall`
3463+
// is exactly what we need to check. This also implies
3464+
// `sc instanceof SummaryCtxNone`.
3465+
// For `FeatureEqualSourceSinkCallContext` the initial call context was
3466+
// set to `CallContextSomeCall` and jumps are disallowed, so
3467+
// `cc instanceof CallContextNoCall` never holds. On the other hand,
3468+
// in this case there's never any need to enter a call except to identify
3469+
// a summary, so the condition in `pathIntoCallable` enforces this, which
3470+
// means that `sc instanceof SummaryCtxNone` holds if and only if we are
3471+
// in the call context of the source.
34623472
sc instanceof SummaryCtxNone or
34633473
cc instanceof CallContextNoCall
34643474
else any()
@@ -3664,6 +3674,9 @@ private predicate pathIntoCallable(
36643674
or
36653675
not exists(TSummaryCtxSome(p, ap)) and
36663676
sc = TSummaryCtxNone() and
3677+
// When the call contexts of source and sink needs to match then there's
3678+
// never any reason to enter a callable except to find a summary. See also
3679+
// the comment in `PathNodeMid::isAtSink`.
36673680
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
36683681
)
36693682
|

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3459,6 +3459,16 @@ private class PathNodeMid extends PathNodeImpl, TPathNodeMid {
34593459
ap instanceof AccessPathNil and
34603460
if hasSinkCallCtx(config)
34613461
then
3462+
// For `FeatureHasSinkCallContext` the condition `cc instanceof CallContextNoCall`
3463+
// is exactly what we need to check. This also implies
3464+
// `sc instanceof SummaryCtxNone`.
3465+
// For `FeatureEqualSourceSinkCallContext` the initial call context was
3466+
// set to `CallContextSomeCall` and jumps are disallowed, so
3467+
// `cc instanceof CallContextNoCall` never holds. On the other hand,
3468+
// in this case there's never any need to enter a call except to identify
3469+
// a summary, so the condition in `pathIntoCallable` enforces this, which
3470+
// means that `sc instanceof SummaryCtxNone` holds if and only if we are
3471+
// in the call context of the source.
34623472
sc instanceof SummaryCtxNone or
34633473
cc instanceof CallContextNoCall
34643474
else any()
@@ -3664,6 +3674,9 @@ private predicate pathIntoCallable(
36643674
or
36653675
not exists(TSummaryCtxSome(p, ap)) and
36663676
sc = TSummaryCtxNone() and
3677+
// When the call contexts of source and sink needs to match then there's
3678+
// never any reason to enter a callable except to find a summary. See also
3679+
// the comment in `PathNodeMid::isAtSink`.
36673680
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
36683681
)
36693682
|

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3459,6 +3459,16 @@ private class PathNodeMid extends PathNodeImpl, TPathNodeMid {
34593459
ap instanceof AccessPathNil and
34603460
if hasSinkCallCtx(config)
34613461
then
3462+
// For `FeatureHasSinkCallContext` the condition `cc instanceof CallContextNoCall`
3463+
// is exactly what we need to check. This also implies
3464+
// `sc instanceof SummaryCtxNone`.
3465+
// For `FeatureEqualSourceSinkCallContext` the initial call context was
3466+
// set to `CallContextSomeCall` and jumps are disallowed, so
3467+
// `cc instanceof CallContextNoCall` never holds. On the other hand,
3468+
// in this case there's never any need to enter a call except to identify
3469+
// a summary, so the condition in `pathIntoCallable` enforces this, which
3470+
// means that `sc instanceof SummaryCtxNone` holds if and only if we are
3471+
// in the call context of the source.
34623472
sc instanceof SummaryCtxNone or
34633473
cc instanceof CallContextNoCall
34643474
else any()
@@ -3664,6 +3674,9 @@ private predicate pathIntoCallable(
36643674
or
36653675
not exists(TSummaryCtxSome(p, ap)) and
36663676
sc = TSummaryCtxNone() and
3677+
// When the call contexts of source and sink needs to match then there's
3678+
// never any reason to enter a callable except to find a summary. See also
3679+
// the comment in `PathNodeMid::isAtSink`.
36673680
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
36683681
)
36693682
|

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3459,6 +3459,16 @@ private class PathNodeMid extends PathNodeImpl, TPathNodeMid {
34593459
ap instanceof AccessPathNil and
34603460
if hasSinkCallCtx(config)
34613461
then
3462+
// For `FeatureHasSinkCallContext` the condition `cc instanceof CallContextNoCall`
3463+
// is exactly what we need to check. This also implies
3464+
// `sc instanceof SummaryCtxNone`.
3465+
// For `FeatureEqualSourceSinkCallContext` the initial call context was
3466+
// set to `CallContextSomeCall` and jumps are disallowed, so
3467+
// `cc instanceof CallContextNoCall` never holds. On the other hand,
3468+
// in this case there's never any need to enter a call except to identify
3469+
// a summary, so the condition in `pathIntoCallable` enforces this, which
3470+
// means that `sc instanceof SummaryCtxNone` holds if and only if we are
3471+
// in the call context of the source.
34623472
sc instanceof SummaryCtxNone or
34633473
cc instanceof CallContextNoCall
34643474
else any()
@@ -3664,6 +3674,9 @@ private predicate pathIntoCallable(
36643674
or
36653675
not exists(TSummaryCtxSome(p, ap)) and
36663676
sc = TSummaryCtxNone() and
3677+
// When the call contexts of source and sink needs to match then there's
3678+
// never any reason to enter a callable except to find a summary. See also
3679+
// the comment in `PathNodeMid::isAtSink`.
36673680
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
36683681
)
36693682
|

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module DataFlowImplCommonPublic {
1010

1111
/** A flow configuration feature for use in `Configuration::getAFeature()`. */
1212
class FlowFeature extends TFlowFeature {
13-
abstract string toString();
13+
string toString() { none() }
1414
}
1515

1616
/**

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3459,6 +3459,16 @@ private class PathNodeMid extends PathNodeImpl, TPathNodeMid {
34593459
ap instanceof AccessPathNil and
34603460
if hasSinkCallCtx(config)
34613461
then
3462+
// For `FeatureHasSinkCallContext` the condition `cc instanceof CallContextNoCall`
3463+
// is exactly what we need to check. This also implies
3464+
// `sc instanceof SummaryCtxNone`.
3465+
// For `FeatureEqualSourceSinkCallContext` the initial call context was
3466+
// set to `CallContextSomeCall` and jumps are disallowed, so
3467+
// `cc instanceof CallContextNoCall` never holds. On the other hand,
3468+
// in this case there's never any need to enter a call except to identify
3469+
// a summary, so the condition in `pathIntoCallable` enforces this, which
3470+
// means that `sc instanceof SummaryCtxNone` holds if and only if we are
3471+
// in the call context of the source.
34623472
sc instanceof SummaryCtxNone or
34633473
cc instanceof CallContextNoCall
34643474
else any()
@@ -3664,6 +3674,9 @@ private predicate pathIntoCallable(
36643674
or
36653675
not exists(TSummaryCtxSome(p, ap)) and
36663676
sc = TSummaryCtxNone() and
3677+
// When the call contexts of source and sink needs to match then there's
3678+
// never any reason to enter a callable except to find a summary. See also
3679+
// the comment in `PathNodeMid::isAtSink`.
36673680
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
36683681
)
36693682
|

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3459,6 +3459,16 @@ private class PathNodeMid extends PathNodeImpl, TPathNodeMid {
34593459
ap instanceof AccessPathNil and
34603460
if hasSinkCallCtx(config)
34613461
then
3462+
// For `FeatureHasSinkCallContext` the condition `cc instanceof CallContextNoCall`
3463+
// is exactly what we need to check. This also implies
3464+
// `sc instanceof SummaryCtxNone`.
3465+
// For `FeatureEqualSourceSinkCallContext` the initial call context was
3466+
// set to `CallContextSomeCall` and jumps are disallowed, so
3467+
// `cc instanceof CallContextNoCall` never holds. On the other hand,
3468+
// in this case there's never any need to enter a call except to identify
3469+
// a summary, so the condition in `pathIntoCallable` enforces this, which
3470+
// means that `sc instanceof SummaryCtxNone` holds if and only if we are
3471+
// in the call context of the source.
34623472
sc instanceof SummaryCtxNone or
34633473
cc instanceof CallContextNoCall
34643474
else any()
@@ -3664,6 +3674,9 @@ private predicate pathIntoCallable(
36643674
or
36653675
not exists(TSummaryCtxSome(p, ap)) and
36663676
sc = TSummaryCtxNone() and
3677+
// When the call contexts of source and sink needs to match then there's
3678+
// never any reason to enter a callable except to find a summary. See also
3679+
// the comment in `PathNodeMid::isAtSink`.
36673680
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
36683681
)
36693682
|

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3459,6 +3459,16 @@ private class PathNodeMid extends PathNodeImpl, TPathNodeMid {
34593459
ap instanceof AccessPathNil and
34603460
if hasSinkCallCtx(config)
34613461
then
3462+
// For `FeatureHasSinkCallContext` the condition `cc instanceof CallContextNoCall`
3463+
// is exactly what we need to check. This also implies
3464+
// `sc instanceof SummaryCtxNone`.
3465+
// For `FeatureEqualSourceSinkCallContext` the initial call context was
3466+
// set to `CallContextSomeCall` and jumps are disallowed, so
3467+
// `cc instanceof CallContextNoCall` never holds. On the other hand,
3468+
// in this case there's never any need to enter a call except to identify
3469+
// a summary, so the condition in `pathIntoCallable` enforces this, which
3470+
// means that `sc instanceof SummaryCtxNone` holds if and only if we are
3471+
// in the call context of the source.
34623472
sc instanceof SummaryCtxNone or
34633473
cc instanceof CallContextNoCall
34643474
else any()
@@ -3664,6 +3674,9 @@ private predicate pathIntoCallable(
36643674
or
36653675
not exists(TSummaryCtxSome(p, ap)) and
36663676
sc = TSummaryCtxNone() and
3677+
// When the call contexts of source and sink needs to match then there's
3678+
// never any reason to enter a callable except to find a summary. See also
3679+
// the comment in `PathNodeMid::isAtSink`.
36673680
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
36683681
)
36693682
|

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3459,6 +3459,16 @@ private class PathNodeMid extends PathNodeImpl, TPathNodeMid {
34593459
ap instanceof AccessPathNil and
34603460
if hasSinkCallCtx(config)
34613461
then
3462+
// For `FeatureHasSinkCallContext` the condition `cc instanceof CallContextNoCall`
3463+
// is exactly what we need to check. This also implies
3464+
// `sc instanceof SummaryCtxNone`.
3465+
// For `FeatureEqualSourceSinkCallContext` the initial call context was
3466+
// set to `CallContextSomeCall` and jumps are disallowed, so
3467+
// `cc instanceof CallContextNoCall` never holds. On the other hand,
3468+
// in this case there's never any need to enter a call except to identify
3469+
// a summary, so the condition in `pathIntoCallable` enforces this, which
3470+
// means that `sc instanceof SummaryCtxNone` holds if and only if we are
3471+
// in the call context of the source.
34623472
sc instanceof SummaryCtxNone or
34633473
cc instanceof CallContextNoCall
34643474
else any()
@@ -3664,6 +3674,9 @@ private predicate pathIntoCallable(
36643674
or
36653675
not exists(TSummaryCtxSome(p, ap)) and
36663676
sc = TSummaryCtxNone() and
3677+
// When the call contexts of source and sink needs to match then there's
3678+
// never any reason to enter a callable except to find a summary. See also
3679+
// the comment in `PathNodeMid::isAtSink`.
36673680
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
36683681
)
36693682
|

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

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3459,6 +3459,16 @@ private class PathNodeMid extends PathNodeImpl, TPathNodeMid {
34593459
ap instanceof AccessPathNil and
34603460
if hasSinkCallCtx(config)
34613461
then
3462+
// For `FeatureHasSinkCallContext` the condition `cc instanceof CallContextNoCall`
3463+
// is exactly what we need to check. This also implies
3464+
// `sc instanceof SummaryCtxNone`.
3465+
// For `FeatureEqualSourceSinkCallContext` the initial call context was
3466+
// set to `CallContextSomeCall` and jumps are disallowed, so
3467+
// `cc instanceof CallContextNoCall` never holds. On the other hand,
3468+
// in this case there's never any need to enter a call except to identify
3469+
// a summary, so the condition in `pathIntoCallable` enforces this, which
3470+
// means that `sc instanceof SummaryCtxNone` holds if and only if we are
3471+
// in the call context of the source.
34623472
sc instanceof SummaryCtxNone or
34633473
cc instanceof CallContextNoCall
34643474
else any()
@@ -3664,6 +3674,9 @@ private predicate pathIntoCallable(
36643674
or
36653675
not exists(TSummaryCtxSome(p, ap)) and
36663676
sc = TSummaryCtxNone() and
3677+
// When the call contexts of source and sink needs to match then there's
3678+
// never any reason to enter a callable except to find a summary. See also
3679+
// the comment in `PathNodeMid::isAtSink`.
36673680
not config.getAFeature() instanceof FeatureEqualSourceSinkCallContext
36683681
)
36693682
|

0 commit comments

Comments
 (0)