Skip to content

Commit 5baa133

Browse files
committed
Data flow: Sync files
1 parent b1245ee commit 5baa133

File tree

18 files changed

+252
-126
lines changed

18 files changed

+252
-126
lines changed

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -510,13 +510,20 @@ private predicate simpleParameterFlow(
510510

511511
pragma[noinline]
512512
private predicate simpleArgumentFlowsThrough0(
513+
ParameterNode p, ReturnNode ret, ReturnKind kind, DataFlowType t, Configuration config
514+
) {
515+
simpleParameterFlow(p, ret, t, config) and
516+
kind = ret.getKind()
517+
}
518+
519+
pragma[noinline]
520+
private predicate simpleArgumentFlowsThrough1(
513521
DataFlowCall call, ArgumentNode arg, ReturnKind kind, DataFlowType t, Configuration config
514522
) {
515523
nodeCand1(arg, unbind(config)) and
516524
not outBarrier(arg, config) and
517525
exists(ParameterNode p, ReturnNode ret |
518-
simpleParameterFlow(p, ret, t, config) and
519-
kind = ret.getKind() and
526+
simpleArgumentFlowsThrough0(p, ret, kind, t, config) and
520527
viableParamArg(call, p, arg)
521528
)
522529
}
@@ -534,7 +541,7 @@ private predicate simpleArgumentFlowsThrough(
534541
exists(DataFlowCall call, ReturnKind kind |
535542
nodeCand1(out, unbind(config)) and
536543
not inBarrier(out, config) and
537-
simpleArgumentFlowsThrough0(call, arg, kind, t, config) and
544+
simpleArgumentFlowsThrough1(call, arg, kind, t, config) and
538545
out = getAnOutNode(call, kind)
539546
)
540547
}
@@ -1529,19 +1536,19 @@ private predicate flow0(Node node, boolean toReturn, AccessPath ap, Configuratio
15291536
)
15301537
or
15311538
exists(Content f, AccessPath ap0 |
1532-
flowStore(node, f, toReturn, ap0, config) and
1539+
flowStore(ap0, f, node, toReturn, config) and
15331540
pop(ap0, f, ap)
15341541
)
15351542
or
15361543
exists(Content f, AccessPath ap0 |
1537-
flowRead(node, f, toReturn, ap0, config) and
1544+
flowRead(f, ap0, node, toReturn, config) and
15381545
push(ap0, f, ap)
15391546
)
15401547
}
15411548

15421549
pragma[nomagic]
15431550
private predicate flowStore(
1544-
Node node, Content f, boolean toReturn, AccessPath ap0, Configuration config
1551+
AccessPath ap0, Content f, Node node, boolean toReturn, Configuration config
15451552
) {
15461553
exists(Node mid |
15471554
store(node, f, mid) and
@@ -1551,7 +1558,7 @@ private predicate flowStore(
15511558

15521559
pragma[nomagic]
15531560
private predicate flowRead(
1554-
Node node, Content f, boolean toReturn, AccessPath ap0, Configuration config
1561+
Content f, AccessPath ap0, Node node, boolean toReturn, Configuration config
15551562
) {
15561563
exists(Node mid |
15571564
read(node, f, mid) and

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -510,13 +510,20 @@ private predicate simpleParameterFlow(
510510

511511
pragma[noinline]
512512
private predicate simpleArgumentFlowsThrough0(
513+
ParameterNode p, ReturnNode ret, ReturnKind kind, DataFlowType t, Configuration config
514+
) {
515+
simpleParameterFlow(p, ret, t, config) and
516+
kind = ret.getKind()
517+
}
518+
519+
pragma[noinline]
520+
private predicate simpleArgumentFlowsThrough1(
513521
DataFlowCall call, ArgumentNode arg, ReturnKind kind, DataFlowType t, Configuration config
514522
) {
515523
nodeCand1(arg, unbind(config)) and
516524
not outBarrier(arg, config) and
517525
exists(ParameterNode p, ReturnNode ret |
518-
simpleParameterFlow(p, ret, t, config) and
519-
kind = ret.getKind() and
526+
simpleArgumentFlowsThrough0(p, ret, kind, t, config) and
520527
viableParamArg(call, p, arg)
521528
)
522529
}
@@ -534,7 +541,7 @@ private predicate simpleArgumentFlowsThrough(
534541
exists(DataFlowCall call, ReturnKind kind |
535542
nodeCand1(out, unbind(config)) and
536543
not inBarrier(out, config) and
537-
simpleArgumentFlowsThrough0(call, arg, kind, t, config) and
544+
simpleArgumentFlowsThrough1(call, arg, kind, t, config) and
538545
out = getAnOutNode(call, kind)
539546
)
540547
}
@@ -1529,19 +1536,19 @@ private predicate flow0(Node node, boolean toReturn, AccessPath ap, Configuratio
15291536
)
15301537
or
15311538
exists(Content f, AccessPath ap0 |
1532-
flowStore(node, f, toReturn, ap0, config) and
1539+
flowStore(ap0, f, node, toReturn, config) and
15331540
pop(ap0, f, ap)
15341541
)
15351542
or
15361543
exists(Content f, AccessPath ap0 |
1537-
flowRead(node, f, toReturn, ap0, config) and
1544+
flowRead(f, ap0, node, toReturn, config) and
15381545
push(ap0, f, ap)
15391546
)
15401547
}
15411548

15421549
pragma[nomagic]
15431550
private predicate flowStore(
1544-
Node node, Content f, boolean toReturn, AccessPath ap0, Configuration config
1551+
AccessPath ap0, Content f, Node node, boolean toReturn, Configuration config
15451552
) {
15461553
exists(Node mid |
15471554
store(node, f, mid) and
@@ -1551,7 +1558,7 @@ private predicate flowStore(
15511558

15521559
pragma[nomagic]
15531560
private predicate flowRead(
1554-
Node node, Content f, boolean toReturn, AccessPath ap0, Configuration config
1561+
Content f, AccessPath ap0, Node node, boolean toReturn, Configuration config
15551562
) {
15561563
exists(Node mid |
15571564
read(node, f, mid) and

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -510,13 +510,20 @@ private predicate simpleParameterFlow(
510510

511511
pragma[noinline]
512512
private predicate simpleArgumentFlowsThrough0(
513+
ParameterNode p, ReturnNode ret, ReturnKind kind, DataFlowType t, Configuration config
514+
) {
515+
simpleParameterFlow(p, ret, t, config) and
516+
kind = ret.getKind()
517+
}
518+
519+
pragma[noinline]
520+
private predicate simpleArgumentFlowsThrough1(
513521
DataFlowCall call, ArgumentNode arg, ReturnKind kind, DataFlowType t, Configuration config
514522
) {
515523
nodeCand1(arg, unbind(config)) and
516524
not outBarrier(arg, config) and
517525
exists(ParameterNode p, ReturnNode ret |
518-
simpleParameterFlow(p, ret, t, config) and
519-
kind = ret.getKind() and
526+
simpleArgumentFlowsThrough0(p, ret, kind, t, config) and
520527
viableParamArg(call, p, arg)
521528
)
522529
}
@@ -534,7 +541,7 @@ private predicate simpleArgumentFlowsThrough(
534541
exists(DataFlowCall call, ReturnKind kind |
535542
nodeCand1(out, unbind(config)) and
536543
not inBarrier(out, config) and
537-
simpleArgumentFlowsThrough0(call, arg, kind, t, config) and
544+
simpleArgumentFlowsThrough1(call, arg, kind, t, config) and
538545
out = getAnOutNode(call, kind)
539546
)
540547
}
@@ -1529,19 +1536,19 @@ private predicate flow0(Node node, boolean toReturn, AccessPath ap, Configuratio
15291536
)
15301537
or
15311538
exists(Content f, AccessPath ap0 |
1532-
flowStore(node, f, toReturn, ap0, config) and
1539+
flowStore(ap0, f, node, toReturn, config) and
15331540
pop(ap0, f, ap)
15341541
)
15351542
or
15361543
exists(Content f, AccessPath ap0 |
1537-
flowRead(node, f, toReturn, ap0, config) and
1544+
flowRead(f, ap0, node, toReturn, config) and
15381545
push(ap0, f, ap)
15391546
)
15401547
}
15411548

15421549
pragma[nomagic]
15431550
private predicate flowStore(
1544-
Node node, Content f, boolean toReturn, AccessPath ap0, Configuration config
1551+
AccessPath ap0, Content f, Node node, boolean toReturn, Configuration config
15451552
) {
15461553
exists(Node mid |
15471554
store(node, f, mid) and
@@ -1551,7 +1558,7 @@ private predicate flowStore(
15511558

15521559
pragma[nomagic]
15531560
private predicate flowRead(
1554-
Node node, Content f, boolean toReturn, AccessPath ap0, Configuration config
1561+
Content f, AccessPath ap0, Node node, boolean toReturn, Configuration config
15551562
) {
15561563
exists(Node mid |
15571564
read(node, f, mid) and

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -510,13 +510,20 @@ private predicate simpleParameterFlow(
510510

511511
pragma[noinline]
512512
private predicate simpleArgumentFlowsThrough0(
513+
ParameterNode p, ReturnNode ret, ReturnKind kind, DataFlowType t, Configuration config
514+
) {
515+
simpleParameterFlow(p, ret, t, config) and
516+
kind = ret.getKind()
517+
}
518+
519+
pragma[noinline]
520+
private predicate simpleArgumentFlowsThrough1(
513521
DataFlowCall call, ArgumentNode arg, ReturnKind kind, DataFlowType t, Configuration config
514522
) {
515523
nodeCand1(arg, unbind(config)) and
516524
not outBarrier(arg, config) and
517525
exists(ParameterNode p, ReturnNode ret |
518-
simpleParameterFlow(p, ret, t, config) and
519-
kind = ret.getKind() and
526+
simpleArgumentFlowsThrough0(p, ret, kind, t, config) and
520527
viableParamArg(call, p, arg)
521528
)
522529
}
@@ -534,7 +541,7 @@ private predicate simpleArgumentFlowsThrough(
534541
exists(DataFlowCall call, ReturnKind kind |
535542
nodeCand1(out, unbind(config)) and
536543
not inBarrier(out, config) and
537-
simpleArgumentFlowsThrough0(call, arg, kind, t, config) and
544+
simpleArgumentFlowsThrough1(call, arg, kind, t, config) and
538545
out = getAnOutNode(call, kind)
539546
)
540547
}
@@ -1529,19 +1536,19 @@ private predicate flow0(Node node, boolean toReturn, AccessPath ap, Configuratio
15291536
)
15301537
or
15311538
exists(Content f, AccessPath ap0 |
1532-
flowStore(node, f, toReturn, ap0, config) and
1539+
flowStore(ap0, f, node, toReturn, config) and
15331540
pop(ap0, f, ap)
15341541
)
15351542
or
15361543
exists(Content f, AccessPath ap0 |
1537-
flowRead(node, f, toReturn, ap0, config) and
1544+
flowRead(f, ap0, node, toReturn, config) and
15381545
push(ap0, f, ap)
15391546
)
15401547
}
15411548

15421549
pragma[nomagic]
15431550
private predicate flowStore(
1544-
Node node, Content f, boolean toReturn, AccessPath ap0, Configuration config
1551+
AccessPath ap0, Content f, Node node, boolean toReturn, Configuration config
15451552
) {
15461553
exists(Node mid |
15471554
store(node, f, mid) and
@@ -1551,7 +1558,7 @@ private predicate flowStore(
15511558

15521559
pragma[nomagic]
15531560
private predicate flowRead(
1554-
Node node, Content f, boolean toReturn, AccessPath ap0, Configuration config
1561+
Content f, AccessPath ap0, Node node, boolean toReturn, Configuration config
15551562
) {
15561563
exists(Node mid |
15571564
read(node, f, mid) and

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -510,13 +510,20 @@ private predicate simpleParameterFlow(
510510

511511
pragma[noinline]
512512
private predicate simpleArgumentFlowsThrough0(
513+
ParameterNode p, ReturnNode ret, ReturnKind kind, DataFlowType t, Configuration config
514+
) {
515+
simpleParameterFlow(p, ret, t, config) and
516+
kind = ret.getKind()
517+
}
518+
519+
pragma[noinline]
520+
private predicate simpleArgumentFlowsThrough1(
513521
DataFlowCall call, ArgumentNode arg, ReturnKind kind, DataFlowType t, Configuration config
514522
) {
515523
nodeCand1(arg, unbind(config)) and
516524
not outBarrier(arg, config) and
517525
exists(ParameterNode p, ReturnNode ret |
518-
simpleParameterFlow(p, ret, t, config) and
519-
kind = ret.getKind() and
526+
simpleArgumentFlowsThrough0(p, ret, kind, t, config) and
520527
viableParamArg(call, p, arg)
521528
)
522529
}
@@ -534,7 +541,7 @@ private predicate simpleArgumentFlowsThrough(
534541
exists(DataFlowCall call, ReturnKind kind |
535542
nodeCand1(out, unbind(config)) and
536543
not inBarrier(out, config) and
537-
simpleArgumentFlowsThrough0(call, arg, kind, t, config) and
544+
simpleArgumentFlowsThrough1(call, arg, kind, t, config) and
538545
out = getAnOutNode(call, kind)
539546
)
540547
}
@@ -1529,19 +1536,19 @@ private predicate flow0(Node node, boolean toReturn, AccessPath ap, Configuratio
15291536
)
15301537
or
15311538
exists(Content f, AccessPath ap0 |
1532-
flowStore(node, f, toReturn, ap0, config) and
1539+
flowStore(ap0, f, node, toReturn, config) and
15331540
pop(ap0, f, ap)
15341541
)
15351542
or
15361543
exists(Content f, AccessPath ap0 |
1537-
flowRead(node, f, toReturn, ap0, config) and
1544+
flowRead(f, ap0, node, toReturn, config) and
15381545
push(ap0, f, ap)
15391546
)
15401547
}
15411548

15421549
pragma[nomagic]
15431550
private predicate flowStore(
1544-
Node node, Content f, boolean toReturn, AccessPath ap0, Configuration config
1551+
AccessPath ap0, Content f, Node node, boolean toReturn, Configuration config
15451552
) {
15461553
exists(Node mid |
15471554
store(node, f, mid) and
@@ -1551,7 +1558,7 @@ private predicate flowStore(
15511558

15521559
pragma[nomagic]
15531560
private predicate flowRead(
1554-
Node node, Content f, boolean toReturn, AccessPath ap0, Configuration config
1561+
Content f, AccessPath ap0, Node node, boolean toReturn, Configuration config
15551562
) {
15561563
exists(Node mid |
15571564
read(node, f, mid) and

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

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -510,13 +510,20 @@ private predicate simpleParameterFlow(
510510

511511
pragma[noinline]
512512
private predicate simpleArgumentFlowsThrough0(
513+
ParameterNode p, ReturnNode ret, ReturnKind kind, DataFlowType t, Configuration config
514+
) {
515+
simpleParameterFlow(p, ret, t, config) and
516+
kind = ret.getKind()
517+
}
518+
519+
pragma[noinline]
520+
private predicate simpleArgumentFlowsThrough1(
513521
DataFlowCall call, ArgumentNode arg, ReturnKind kind, DataFlowType t, Configuration config
514522
) {
515523
nodeCand1(arg, unbind(config)) and
516524
not outBarrier(arg, config) and
517525
exists(ParameterNode p, ReturnNode ret |
518-
simpleParameterFlow(p, ret, t, config) and
519-
kind = ret.getKind() and
526+
simpleArgumentFlowsThrough0(p, ret, kind, t, config) and
520527
viableParamArg(call, p, arg)
521528
)
522529
}
@@ -534,7 +541,7 @@ private predicate simpleArgumentFlowsThrough(
534541
exists(DataFlowCall call, ReturnKind kind |
535542
nodeCand1(out, unbind(config)) and
536543
not inBarrier(out, config) and
537-
simpleArgumentFlowsThrough0(call, arg, kind, t, config) and
544+
simpleArgumentFlowsThrough1(call, arg, kind, t, config) and
538545
out = getAnOutNode(call, kind)
539546
)
540547
}
@@ -1529,19 +1536,19 @@ private predicate flow0(Node node, boolean toReturn, AccessPath ap, Configuratio
15291536
)
15301537
or
15311538
exists(Content f, AccessPath ap0 |
1532-
flowStore(node, f, toReturn, ap0, config) and
1539+
flowStore(ap0, f, node, toReturn, config) and
15331540
pop(ap0, f, ap)
15341541
)
15351542
or
15361543
exists(Content f, AccessPath ap0 |
1537-
flowRead(node, f, toReturn, ap0, config) and
1544+
flowRead(f, ap0, node, toReturn, config) and
15381545
push(ap0, f, ap)
15391546
)
15401547
}
15411548

15421549
pragma[nomagic]
15431550
private predicate flowStore(
1544-
Node node, Content f, boolean toReturn, AccessPath ap0, Configuration config
1551+
AccessPath ap0, Content f, Node node, boolean toReturn, Configuration config
15451552
) {
15461553
exists(Node mid |
15471554
store(node, f, mid) and
@@ -1551,7 +1558,7 @@ private predicate flowStore(
15511558

15521559
pragma[nomagic]
15531560
private predicate flowRead(
1554-
Node node, Content f, boolean toReturn, AccessPath ap0, Configuration config
1561+
Content f, AccessPath ap0, Node node, boolean toReturn, Configuration config
15551562
) {
15561563
exists(Node mid |
15571564
read(node, f, mid) and

0 commit comments

Comments
 (0)