Skip to content

Commit ff751ac

Browse files
committed
Data flow: Sync files
1 parent 98ed2a1 commit ff751ac

File tree

18 files changed

+288
-288
lines changed

18 files changed

+288
-288
lines changed

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,8 +1051,12 @@ private predicate flowIntoCallNodeCand2(
10511051
}
10521052

10531053
private module LocalFlowBigStep {
1054-
private class BigStepBarrierNode extends Node {
1055-
BigStepBarrierNode() {
1054+
/**
1055+
* A node where some checking is required, and hence the big-step relation
1056+
* is not allowed to step over.
1057+
*/
1058+
private class FlowCheckNode extends Node {
1059+
FlowCheckNode() {
10561060
this instanceof CastNode or
10571061
clearsContent(this, _)
10581062
}
@@ -1072,7 +1076,7 @@ private module LocalFlowBigStep {
10721076
node instanceof OutNodeExt or
10731077
store(_, _, node, _) or
10741078
read(_, _, node) or
1075-
node instanceof BigStepBarrierNode
1079+
node instanceof FlowCheckNode
10761080
)
10771081
}
10781082

@@ -1090,7 +1094,7 @@ private module LocalFlowBigStep {
10901094
read(node, _, next)
10911095
)
10921096
or
1093-
node instanceof BigStepBarrierNode
1097+
node instanceof FlowCheckNode
10941098
or
10951099
config.isSink(node)
10961100
}
@@ -1134,14 +1138,14 @@ private module LocalFlowBigStep {
11341138
exists(Node mid |
11351139
localFlowStepPlus(node1, mid, preservesValue, t, config, cc) and
11361140
localFlowStepNodeCand1(mid, node2, config) and
1137-
not mid instanceof BigStepBarrierNode and
1141+
not mid instanceof FlowCheckNode and
11381142
nodeCand2(node2, unbind(config))
11391143
)
11401144
or
11411145
exists(Node mid |
11421146
localFlowStepPlus(node1, mid, _, _, config, cc) and
11431147
additionalLocalFlowStepNodeCand2(mid, node2, config) and
1144-
not mid instanceof BigStepBarrierNode and
1148+
not mid instanceof FlowCheckNode and
11451149
preservesValue = false and
11461150
t = getErasedNodeTypeBound(node2) and
11471151
nodeCand2(node2, unbind(config))
@@ -1197,6 +1201,7 @@ private predicate flowCandFwd(
11971201
Configuration config
11981202
) {
11991203
flowCandFwd0(node, fromArg, argApf, apf, config) and
1204+
not apf.isClearedAt(node) and
12001205
if node instanceof CastingNode
12011206
then compatibleTypes(getErasedNodeTypeBound(node), apf.getType())
12021207
else any()
@@ -1215,8 +1220,7 @@ private predicate flowCandFwd0(
12151220
or
12161221
exists(Node mid |
12171222
flowCandFwd(mid, fromArg, argApf, apf, config) and
1218-
localFlowBigStep(mid, node, true, _, config, _) and
1219-
not apf.isClearedAt(node)
1223+
localFlowBigStep(mid, node, true, _, config, _)
12201224
)
12211225
or
12221226
exists(Node mid, AccessPathFrontNil nil |
@@ -1229,8 +1233,7 @@ private predicate flowCandFwd0(
12291233
nodeCand2(node, unbind(config)) and
12301234
jumpStep(mid, node, config) and
12311235
fromArg = false and
1232-
argApf = TAccessPathFrontNone() and
1233-
not apf.isClearedAt(node)
1236+
argApf = TAccessPathFrontNone()
12341237
)
12351238
or
12361239
exists(Node mid, AccessPathFrontNil nil |
@@ -1255,8 +1258,7 @@ private predicate flowCandFwd0(
12551258
exists(TypedContent tc |
12561259
flowCandFwdRead(tc, node, fromArg, argApf, config) and
12571260
flowCandFwdConsCand(tc, apf, config) and
1258-
nodeCand2(node, _, _, unbindBool(apf.toBoolNonEmpty()), unbind(config)) and
1259-
not apf.isClearedAt(node)
1261+
nodeCand2(node, _, _, unbindBool(apf.toBoolNonEmpty()), unbind(config))
12601262
)
12611263
or
12621264
// flow into a callable
@@ -1312,8 +1314,7 @@ private predicate flowCandFwdIn(
13121314
) {
13131315
exists(ArgumentNode arg, boolean allowsFieldFlow |
13141316
flowCandFwd(arg, fromArg, argApf, apf, config) and
1315-
flowIntoCallNodeCand2(call, arg, p, allowsFieldFlow, config) and
1316-
not apf.isClearedAt(p)
1317+
flowIntoCallNodeCand2(call, arg, p, allowsFieldFlow, config)
13171318
|
13181319
apf instanceof AccessPathFrontNil or allowsFieldFlow = true
13191320
)
@@ -1326,8 +1327,7 @@ private predicate flowCandFwdOut(
13261327
) {
13271328
exists(ReturnNodeExt ret, boolean allowsFieldFlow |
13281329
flowCandFwd(ret, fromArg, argApf, apf, config) and
1329-
flowOutOfCallNodeCand2(call, ret, node, allowsFieldFlow, config) and
1330-
not apf.isClearedAt(node)
1330+
flowOutOfCallNodeCand2(call, ret, node, allowsFieldFlow, config)
13311331
|
13321332
apf instanceof AccessPathFrontNil or allowsFieldFlow = true
13331333
)

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,8 +1051,12 @@ private predicate flowIntoCallNodeCand2(
10511051
}
10521052

10531053
private module LocalFlowBigStep {
1054-
private class BigStepBarrierNode extends Node {
1055-
BigStepBarrierNode() {
1054+
/**
1055+
* A node where some checking is required, and hence the big-step relation
1056+
* is not allowed to step over.
1057+
*/
1058+
private class FlowCheckNode extends Node {
1059+
FlowCheckNode() {
10561060
this instanceof CastNode or
10571061
clearsContent(this, _)
10581062
}
@@ -1072,7 +1076,7 @@ private module LocalFlowBigStep {
10721076
node instanceof OutNodeExt or
10731077
store(_, _, node, _) or
10741078
read(_, _, node) or
1075-
node instanceof BigStepBarrierNode
1079+
node instanceof FlowCheckNode
10761080
)
10771081
}
10781082

@@ -1090,7 +1094,7 @@ private module LocalFlowBigStep {
10901094
read(node, _, next)
10911095
)
10921096
or
1093-
node instanceof BigStepBarrierNode
1097+
node instanceof FlowCheckNode
10941098
or
10951099
config.isSink(node)
10961100
}
@@ -1134,14 +1138,14 @@ private module LocalFlowBigStep {
11341138
exists(Node mid |
11351139
localFlowStepPlus(node1, mid, preservesValue, t, config, cc) and
11361140
localFlowStepNodeCand1(mid, node2, config) and
1137-
not mid instanceof BigStepBarrierNode and
1141+
not mid instanceof FlowCheckNode and
11381142
nodeCand2(node2, unbind(config))
11391143
)
11401144
or
11411145
exists(Node mid |
11421146
localFlowStepPlus(node1, mid, _, _, config, cc) and
11431147
additionalLocalFlowStepNodeCand2(mid, node2, config) and
1144-
not mid instanceof BigStepBarrierNode and
1148+
not mid instanceof FlowCheckNode and
11451149
preservesValue = false and
11461150
t = getErasedNodeTypeBound(node2) and
11471151
nodeCand2(node2, unbind(config))
@@ -1197,6 +1201,7 @@ private predicate flowCandFwd(
11971201
Configuration config
11981202
) {
11991203
flowCandFwd0(node, fromArg, argApf, apf, config) and
1204+
not apf.isClearedAt(node) and
12001205
if node instanceof CastingNode
12011206
then compatibleTypes(getErasedNodeTypeBound(node), apf.getType())
12021207
else any()
@@ -1215,8 +1220,7 @@ private predicate flowCandFwd0(
12151220
or
12161221
exists(Node mid |
12171222
flowCandFwd(mid, fromArg, argApf, apf, config) and
1218-
localFlowBigStep(mid, node, true, _, config, _) and
1219-
not apf.isClearedAt(node)
1223+
localFlowBigStep(mid, node, true, _, config, _)
12201224
)
12211225
or
12221226
exists(Node mid, AccessPathFrontNil nil |
@@ -1229,8 +1233,7 @@ private predicate flowCandFwd0(
12291233
nodeCand2(node, unbind(config)) and
12301234
jumpStep(mid, node, config) and
12311235
fromArg = false and
1232-
argApf = TAccessPathFrontNone() and
1233-
not apf.isClearedAt(node)
1236+
argApf = TAccessPathFrontNone()
12341237
)
12351238
or
12361239
exists(Node mid, AccessPathFrontNil nil |
@@ -1255,8 +1258,7 @@ private predicate flowCandFwd0(
12551258
exists(TypedContent tc |
12561259
flowCandFwdRead(tc, node, fromArg, argApf, config) and
12571260
flowCandFwdConsCand(tc, apf, config) and
1258-
nodeCand2(node, _, _, unbindBool(apf.toBoolNonEmpty()), unbind(config)) and
1259-
not apf.isClearedAt(node)
1261+
nodeCand2(node, _, _, unbindBool(apf.toBoolNonEmpty()), unbind(config))
12601262
)
12611263
or
12621264
// flow into a callable
@@ -1312,8 +1314,7 @@ private predicate flowCandFwdIn(
13121314
) {
13131315
exists(ArgumentNode arg, boolean allowsFieldFlow |
13141316
flowCandFwd(arg, fromArg, argApf, apf, config) and
1315-
flowIntoCallNodeCand2(call, arg, p, allowsFieldFlow, config) and
1316-
not apf.isClearedAt(p)
1317+
flowIntoCallNodeCand2(call, arg, p, allowsFieldFlow, config)
13171318
|
13181319
apf instanceof AccessPathFrontNil or allowsFieldFlow = true
13191320
)
@@ -1326,8 +1327,7 @@ private predicate flowCandFwdOut(
13261327
) {
13271328
exists(ReturnNodeExt ret, boolean allowsFieldFlow |
13281329
flowCandFwd(ret, fromArg, argApf, apf, config) and
1329-
flowOutOfCallNodeCand2(call, ret, node, allowsFieldFlow, config) and
1330-
not apf.isClearedAt(node)
1330+
flowOutOfCallNodeCand2(call, ret, node, allowsFieldFlow, config)
13311331
|
13321332
apf instanceof AccessPathFrontNil or allowsFieldFlow = true
13331333
)

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,8 +1051,12 @@ private predicate flowIntoCallNodeCand2(
10511051
}
10521052

10531053
private module LocalFlowBigStep {
1054-
private class BigStepBarrierNode extends Node {
1055-
BigStepBarrierNode() {
1054+
/**
1055+
* A node where some checking is required, and hence the big-step relation
1056+
* is not allowed to step over.
1057+
*/
1058+
private class FlowCheckNode extends Node {
1059+
FlowCheckNode() {
10561060
this instanceof CastNode or
10571061
clearsContent(this, _)
10581062
}
@@ -1072,7 +1076,7 @@ private module LocalFlowBigStep {
10721076
node instanceof OutNodeExt or
10731077
store(_, _, node, _) or
10741078
read(_, _, node) or
1075-
node instanceof BigStepBarrierNode
1079+
node instanceof FlowCheckNode
10761080
)
10771081
}
10781082

@@ -1090,7 +1094,7 @@ private module LocalFlowBigStep {
10901094
read(node, _, next)
10911095
)
10921096
or
1093-
node instanceof BigStepBarrierNode
1097+
node instanceof FlowCheckNode
10941098
or
10951099
config.isSink(node)
10961100
}
@@ -1134,14 +1138,14 @@ private module LocalFlowBigStep {
11341138
exists(Node mid |
11351139
localFlowStepPlus(node1, mid, preservesValue, t, config, cc) and
11361140
localFlowStepNodeCand1(mid, node2, config) and
1137-
not mid instanceof BigStepBarrierNode and
1141+
not mid instanceof FlowCheckNode and
11381142
nodeCand2(node2, unbind(config))
11391143
)
11401144
or
11411145
exists(Node mid |
11421146
localFlowStepPlus(node1, mid, _, _, config, cc) and
11431147
additionalLocalFlowStepNodeCand2(mid, node2, config) and
1144-
not mid instanceof BigStepBarrierNode and
1148+
not mid instanceof FlowCheckNode and
11451149
preservesValue = false and
11461150
t = getErasedNodeTypeBound(node2) and
11471151
nodeCand2(node2, unbind(config))
@@ -1197,6 +1201,7 @@ private predicate flowCandFwd(
11971201
Configuration config
11981202
) {
11991203
flowCandFwd0(node, fromArg, argApf, apf, config) and
1204+
not apf.isClearedAt(node) and
12001205
if node instanceof CastingNode
12011206
then compatibleTypes(getErasedNodeTypeBound(node), apf.getType())
12021207
else any()
@@ -1215,8 +1220,7 @@ private predicate flowCandFwd0(
12151220
or
12161221
exists(Node mid |
12171222
flowCandFwd(mid, fromArg, argApf, apf, config) and
1218-
localFlowBigStep(mid, node, true, _, config, _) and
1219-
not apf.isClearedAt(node)
1223+
localFlowBigStep(mid, node, true, _, config, _)
12201224
)
12211225
or
12221226
exists(Node mid, AccessPathFrontNil nil |
@@ -1229,8 +1233,7 @@ private predicate flowCandFwd0(
12291233
nodeCand2(node, unbind(config)) and
12301234
jumpStep(mid, node, config) and
12311235
fromArg = false and
1232-
argApf = TAccessPathFrontNone() and
1233-
not apf.isClearedAt(node)
1236+
argApf = TAccessPathFrontNone()
12341237
)
12351238
or
12361239
exists(Node mid, AccessPathFrontNil nil |
@@ -1255,8 +1258,7 @@ private predicate flowCandFwd0(
12551258
exists(TypedContent tc |
12561259
flowCandFwdRead(tc, node, fromArg, argApf, config) and
12571260
flowCandFwdConsCand(tc, apf, config) and
1258-
nodeCand2(node, _, _, unbindBool(apf.toBoolNonEmpty()), unbind(config)) and
1259-
not apf.isClearedAt(node)
1261+
nodeCand2(node, _, _, unbindBool(apf.toBoolNonEmpty()), unbind(config))
12601262
)
12611263
or
12621264
// flow into a callable
@@ -1312,8 +1314,7 @@ private predicate flowCandFwdIn(
13121314
) {
13131315
exists(ArgumentNode arg, boolean allowsFieldFlow |
13141316
flowCandFwd(arg, fromArg, argApf, apf, config) and
1315-
flowIntoCallNodeCand2(call, arg, p, allowsFieldFlow, config) and
1316-
not apf.isClearedAt(p)
1317+
flowIntoCallNodeCand2(call, arg, p, allowsFieldFlow, config)
13171318
|
13181319
apf instanceof AccessPathFrontNil or allowsFieldFlow = true
13191320
)
@@ -1326,8 +1327,7 @@ private predicate flowCandFwdOut(
13261327
) {
13271328
exists(ReturnNodeExt ret, boolean allowsFieldFlow |
13281329
flowCandFwd(ret, fromArg, argApf, apf, config) and
1329-
flowOutOfCallNodeCand2(call, ret, node, allowsFieldFlow, config) and
1330-
not apf.isClearedAt(node)
1330+
flowOutOfCallNodeCand2(call, ret, node, allowsFieldFlow, config)
13311331
|
13321332
apf instanceof AccessPathFrontNil or allowsFieldFlow = true
13331333
)

0 commit comments

Comments
 (0)