Skip to content

Commit dfa79f6

Browse files
committed
Dataflow: Sync.
1 parent 46736a1 commit dfa79f6

File tree

26 files changed

+260
-104
lines changed

26 files changed

+260
-104
lines changed

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3729,7 +3729,7 @@ private predicate directReach(PathNode n) {
37293729
n instanceof PathNodeSink or directReach(n.getASuccessor())
37303730
}
37313731

3732-
/** Holds if `n` can reach a sink or is used in a subpath. */
3732+
/** Holds if `n` can reach a sink or is used in a subpath that can reach a sink. */
37333733
private predicate reach(PathNode n) { directReach(n) or Subpaths::retReach(n) }
37343734

37353735
/** Holds if `n1.getASuccessor() = n2` and `n2` can reach a sink. */
@@ -3749,7 +3749,13 @@ module PathGraph {
37493749
reach(n) and key = "semmle.label" and val = n.toString()
37503750
}
37513751

3752-
query predicate subpaths = Subpaths::subpaths/4;
3752+
query predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out) {
3753+
Subpaths::subpaths(arg, par, ret, out) and
3754+
reach(arg) and
3755+
reach(par) and
3756+
reach(ret) and
3757+
reach(out)
3758+
}
37533759
}
37543760

37553761
/**
@@ -4183,10 +4189,10 @@ private module Subpaths {
41834189
}
41844190

41854191
/**
4186-
* Holds if `n` can reach a return node in a summarized subpath.
4192+
* Holds if `n` can reach a return node in a summarized subpath that can reach a sink.
41874193
*/
41884194
predicate retReach(PathNode n) {
4189-
subpaths(_, _, n, _)
4195+
exists(PathNodeMid out | subpaths(_, _, n, out) | directReach(out) or retReach(out))
41904196
or
41914197
exists(PathNode mid |
41924198
retReach(mid) and

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3729,7 +3729,7 @@ private predicate directReach(PathNode n) {
37293729
n instanceof PathNodeSink or directReach(n.getASuccessor())
37303730
}
37313731

3732-
/** Holds if `n` can reach a sink or is used in a subpath. */
3732+
/** Holds if `n` can reach a sink or is used in a subpath that can reach a sink. */
37333733
private predicate reach(PathNode n) { directReach(n) or Subpaths::retReach(n) }
37343734

37353735
/** Holds if `n1.getASuccessor() = n2` and `n2` can reach a sink. */
@@ -3749,7 +3749,13 @@ module PathGraph {
37493749
reach(n) and key = "semmle.label" and val = n.toString()
37503750
}
37513751

3752-
query predicate subpaths = Subpaths::subpaths/4;
3752+
query predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out) {
3753+
Subpaths::subpaths(arg, par, ret, out) and
3754+
reach(arg) and
3755+
reach(par) and
3756+
reach(ret) and
3757+
reach(out)
3758+
}
37533759
}
37543760

37553761
/**
@@ -4183,10 +4189,10 @@ private module Subpaths {
41834189
}
41844190

41854191
/**
4186-
* Holds if `n` can reach a return node in a summarized subpath.
4192+
* Holds if `n` can reach a return node in a summarized subpath that can reach a sink.
41874193
*/
41884194
predicate retReach(PathNode n) {
4189-
subpaths(_, _, n, _)
4195+
exists(PathNodeMid out | subpaths(_, _, n, out) | directReach(out) or retReach(out))
41904196
or
41914197
exists(PathNode mid |
41924198
retReach(mid) and

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3729,7 +3729,7 @@ private predicate directReach(PathNode n) {
37293729
n instanceof PathNodeSink or directReach(n.getASuccessor())
37303730
}
37313731

3732-
/** Holds if `n` can reach a sink or is used in a subpath. */
3732+
/** Holds if `n` can reach a sink or is used in a subpath that can reach a sink. */
37333733
private predicate reach(PathNode n) { directReach(n) or Subpaths::retReach(n) }
37343734

37353735
/** Holds if `n1.getASuccessor() = n2` and `n2` can reach a sink. */
@@ -3749,7 +3749,13 @@ module PathGraph {
37493749
reach(n) and key = "semmle.label" and val = n.toString()
37503750
}
37513751

3752-
query predicate subpaths = Subpaths::subpaths/4;
3752+
query predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out) {
3753+
Subpaths::subpaths(arg, par, ret, out) and
3754+
reach(arg) and
3755+
reach(par) and
3756+
reach(ret) and
3757+
reach(out)
3758+
}
37533759
}
37543760

37553761
/**
@@ -4183,10 +4189,10 @@ private module Subpaths {
41834189
}
41844190

41854191
/**
4186-
* Holds if `n` can reach a return node in a summarized subpath.
4192+
* Holds if `n` can reach a return node in a summarized subpath that can reach a sink.
41874193
*/
41884194
predicate retReach(PathNode n) {
4189-
subpaths(_, _, n, _)
4195+
exists(PathNodeMid out | subpaths(_, _, n, out) | directReach(out) or retReach(out))
41904196
or
41914197
exists(PathNode mid |
41924198
retReach(mid) and

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3729,7 +3729,7 @@ private predicate directReach(PathNode n) {
37293729
n instanceof PathNodeSink or directReach(n.getASuccessor())
37303730
}
37313731

3732-
/** Holds if `n` can reach a sink or is used in a subpath. */
3732+
/** Holds if `n` can reach a sink or is used in a subpath that can reach a sink. */
37333733
private predicate reach(PathNode n) { directReach(n) or Subpaths::retReach(n) }
37343734

37353735
/** Holds if `n1.getASuccessor() = n2` and `n2` can reach a sink. */
@@ -3749,7 +3749,13 @@ module PathGraph {
37493749
reach(n) and key = "semmle.label" and val = n.toString()
37503750
}
37513751

3752-
query predicate subpaths = Subpaths::subpaths/4;
3752+
query predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out) {
3753+
Subpaths::subpaths(arg, par, ret, out) and
3754+
reach(arg) and
3755+
reach(par) and
3756+
reach(ret) and
3757+
reach(out)
3758+
}
37533759
}
37543760

37553761
/**
@@ -4183,10 +4189,10 @@ private module Subpaths {
41834189
}
41844190

41854191
/**
4186-
* Holds if `n` can reach a return node in a summarized subpath.
4192+
* Holds if `n` can reach a return node in a summarized subpath that can reach a sink.
41874193
*/
41884194
predicate retReach(PathNode n) {
4189-
subpaths(_, _, n, _)
4195+
exists(PathNodeMid out | subpaths(_, _, n, out) | directReach(out) or retReach(out))
41904196
or
41914197
exists(PathNode mid |
41924198
retReach(mid) and

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3729,7 +3729,7 @@ private predicate directReach(PathNode n) {
37293729
n instanceof PathNodeSink or directReach(n.getASuccessor())
37303730
}
37313731

3732-
/** Holds if `n` can reach a sink or is used in a subpath. */
3732+
/** Holds if `n` can reach a sink or is used in a subpath that can reach a sink. */
37333733
private predicate reach(PathNode n) { directReach(n) or Subpaths::retReach(n) }
37343734

37353735
/** Holds if `n1.getASuccessor() = n2` and `n2` can reach a sink. */
@@ -3749,7 +3749,13 @@ module PathGraph {
37493749
reach(n) and key = "semmle.label" and val = n.toString()
37503750
}
37513751

3752-
query predicate subpaths = Subpaths::subpaths/4;
3752+
query predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out) {
3753+
Subpaths::subpaths(arg, par, ret, out) and
3754+
reach(arg) and
3755+
reach(par) and
3756+
reach(ret) and
3757+
reach(out)
3758+
}
37533759
}
37543760

37553761
/**
@@ -4183,10 +4189,10 @@ private module Subpaths {
41834189
}
41844190

41854191
/**
4186-
* Holds if `n` can reach a return node in a summarized subpath.
4192+
* Holds if `n` can reach a return node in a summarized subpath that can reach a sink.
41874193
*/
41884194
predicate retReach(PathNode n) {
4189-
subpaths(_, _, n, _)
4195+
exists(PathNodeMid out | subpaths(_, _, n, out) | directReach(out) or retReach(out))
41904196
or
41914197
exists(PathNode mid |
41924198
retReach(mid) and

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3729,7 +3729,7 @@ private predicate directReach(PathNode n) {
37293729
n instanceof PathNodeSink or directReach(n.getASuccessor())
37303730
}
37313731

3732-
/** Holds if `n` can reach a sink or is used in a subpath. */
3732+
/** Holds if `n` can reach a sink or is used in a subpath that can reach a sink. */
37333733
private predicate reach(PathNode n) { directReach(n) or Subpaths::retReach(n) }
37343734

37353735
/** Holds if `n1.getASuccessor() = n2` and `n2` can reach a sink. */
@@ -3749,7 +3749,13 @@ module PathGraph {
37493749
reach(n) and key = "semmle.label" and val = n.toString()
37503750
}
37513751

3752-
query predicate subpaths = Subpaths::subpaths/4;
3752+
query predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out) {
3753+
Subpaths::subpaths(arg, par, ret, out) and
3754+
reach(arg) and
3755+
reach(par) and
3756+
reach(ret) and
3757+
reach(out)
3758+
}
37533759
}
37543760

37553761
/**
@@ -4183,10 +4189,10 @@ private module Subpaths {
41834189
}
41844190

41854191
/**
4186-
* Holds if `n` can reach a return node in a summarized subpath.
4192+
* Holds if `n` can reach a return node in a summarized subpath that can reach a sink.
41874193
*/
41884194
predicate retReach(PathNode n) {
4189-
subpaths(_, _, n, _)
4195+
exists(PathNodeMid out | subpaths(_, _, n, out) | directReach(out) or retReach(out))
41904196
or
41914197
exists(PathNode mid |
41924198
retReach(mid) and

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3729,7 +3729,7 @@ private predicate directReach(PathNode n) {
37293729
n instanceof PathNodeSink or directReach(n.getASuccessor())
37303730
}
37313731

3732-
/** Holds if `n` can reach a sink or is used in a subpath. */
3732+
/** Holds if `n` can reach a sink or is used in a subpath that can reach a sink. */
37333733
private predicate reach(PathNode n) { directReach(n) or Subpaths::retReach(n) }
37343734

37353735
/** Holds if `n1.getASuccessor() = n2` and `n2` can reach a sink. */
@@ -3749,7 +3749,13 @@ module PathGraph {
37493749
reach(n) and key = "semmle.label" and val = n.toString()
37503750
}
37513751

3752-
query predicate subpaths = Subpaths::subpaths/4;
3752+
query predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out) {
3753+
Subpaths::subpaths(arg, par, ret, out) and
3754+
reach(arg) and
3755+
reach(par) and
3756+
reach(ret) and
3757+
reach(out)
3758+
}
37533759
}
37543760

37553761
/**
@@ -4183,10 +4189,10 @@ private module Subpaths {
41834189
}
41844190

41854191
/**
4186-
* Holds if `n` can reach a return node in a summarized subpath.
4192+
* Holds if `n` can reach a return node in a summarized subpath that can reach a sink.
41874193
*/
41884194
predicate retReach(PathNode n) {
4189-
subpaths(_, _, n, _)
4195+
exists(PathNodeMid out | subpaths(_, _, n, out) | directReach(out) or retReach(out))
41904196
or
41914197
exists(PathNode mid |
41924198
retReach(mid) and

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3729,7 +3729,7 @@ private predicate directReach(PathNode n) {
37293729
n instanceof PathNodeSink or directReach(n.getASuccessor())
37303730
}
37313731

3732-
/** Holds if `n` can reach a sink or is used in a subpath. */
3732+
/** Holds if `n` can reach a sink or is used in a subpath that can reach a sink. */
37333733
private predicate reach(PathNode n) { directReach(n) or Subpaths::retReach(n) }
37343734

37353735
/** Holds if `n1.getASuccessor() = n2` and `n2` can reach a sink. */
@@ -3749,7 +3749,13 @@ module PathGraph {
37493749
reach(n) and key = "semmle.label" and val = n.toString()
37503750
}
37513751

3752-
query predicate subpaths = Subpaths::subpaths/4;
3752+
query predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out) {
3753+
Subpaths::subpaths(arg, par, ret, out) and
3754+
reach(arg) and
3755+
reach(par) and
3756+
reach(ret) and
3757+
reach(out)
3758+
}
37533759
}
37543760

37553761
/**
@@ -4183,10 +4189,10 @@ private module Subpaths {
41834189
}
41844190

41854191
/**
4186-
* Holds if `n` can reach a return node in a summarized subpath.
4192+
* Holds if `n` can reach a return node in a summarized subpath that can reach a sink.
41874193
*/
41884194
predicate retReach(PathNode n) {
4189-
subpaths(_, _, n, _)
4195+
exists(PathNodeMid out | subpaths(_, _, n, out) | directReach(out) or retReach(out))
41904196
or
41914197
exists(PathNode mid |
41924198
retReach(mid) and

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3729,7 +3729,7 @@ private predicate directReach(PathNode n) {
37293729
n instanceof PathNodeSink or directReach(n.getASuccessor())
37303730
}
37313731

3732-
/** Holds if `n` can reach a sink or is used in a subpath. */
3732+
/** Holds if `n` can reach a sink or is used in a subpath that can reach a sink. */
37333733
private predicate reach(PathNode n) { directReach(n) or Subpaths::retReach(n) }
37343734

37353735
/** Holds if `n1.getASuccessor() = n2` and `n2` can reach a sink. */
@@ -3749,7 +3749,13 @@ module PathGraph {
37493749
reach(n) and key = "semmle.label" and val = n.toString()
37503750
}
37513751

3752-
query predicate subpaths = Subpaths::subpaths/4;
3752+
query predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out) {
3753+
Subpaths::subpaths(arg, par, ret, out) and
3754+
reach(arg) and
3755+
reach(par) and
3756+
reach(ret) and
3757+
reach(out)
3758+
}
37533759
}
37543760

37553761
/**
@@ -4183,10 +4189,10 @@ private module Subpaths {
41834189
}
41844190

41854191
/**
4186-
* Holds if `n` can reach a return node in a summarized subpath.
4192+
* Holds if `n` can reach a return node in a summarized subpath that can reach a sink.
41874193
*/
41884194
predicate retReach(PathNode n) {
4189-
subpaths(_, _, n, _)
4195+
exists(PathNodeMid out | subpaths(_, _, n, out) | directReach(out) or retReach(out))
41904196
or
41914197
exists(PathNode mid |
41924198
retReach(mid) and

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

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3729,7 +3729,7 @@ private predicate directReach(PathNode n) {
37293729
n instanceof PathNodeSink or directReach(n.getASuccessor())
37303730
}
37313731

3732-
/** Holds if `n` can reach a sink or is used in a subpath. */
3732+
/** Holds if `n` can reach a sink or is used in a subpath that can reach a sink. */
37333733
private predicate reach(PathNode n) { directReach(n) or Subpaths::retReach(n) }
37343734

37353735
/** Holds if `n1.getASuccessor() = n2` and `n2` can reach a sink. */
@@ -3749,7 +3749,13 @@ module PathGraph {
37493749
reach(n) and key = "semmle.label" and val = n.toString()
37503750
}
37513751

3752-
query predicate subpaths = Subpaths::subpaths/4;
3752+
query predicate subpaths(PathNode arg, PathNode par, PathNode ret, PathNode out) {
3753+
Subpaths::subpaths(arg, par, ret, out) and
3754+
reach(arg) and
3755+
reach(par) and
3756+
reach(ret) and
3757+
reach(out)
3758+
}
37533759
}
37543760

37553761
/**
@@ -4183,10 +4189,10 @@ private module Subpaths {
41834189
}
41844190

41854191
/**
4186-
* Holds if `n` can reach a return node in a summarized subpath.
4192+
* Holds if `n` can reach a return node in a summarized subpath that can reach a sink.
41874193
*/
41884194
predicate retReach(PathNode n) {
4189-
subpaths(_, _, n, _)
4195+
exists(PathNodeMid out | subpaths(_, _, n, out) | directReach(out) or retReach(out))
41904196
or
41914197
exists(PathNode mid |
41924198
retReach(mid) and

0 commit comments

Comments
 (0)