@@ -1051,6 +1051,13 @@ private predicate flowIntoCallNodeCand2(
1051
1051
}
1052
1052
1053
1053
private module LocalFlowBigStep {
1054
+ private class BigStepBarrierNode extends Node {
1055
+ BigStepBarrierNode ( ) {
1056
+ this instanceof CastNode or
1057
+ clearsContent ( this , _)
1058
+ }
1059
+ }
1060
+
1054
1061
/**
1055
1062
* Holds if `node` can be the first node in a maximal subsequence of local
1056
1063
* flow steps in a dataflow path.
@@ -1065,7 +1072,7 @@ private module LocalFlowBigStep {
1065
1072
node instanceof OutNodeExt or
1066
1073
store ( _, _, node , _) or
1067
1074
read ( _, _, node ) or
1068
- node instanceof CastNode
1075
+ node instanceof BigStepBarrierNode
1069
1076
)
1070
1077
}
1071
1078
@@ -1083,7 +1090,7 @@ private module LocalFlowBigStep {
1083
1090
read ( node , _, next )
1084
1091
)
1085
1092
or
1086
- node instanceof CastNode
1093
+ node instanceof BigStepBarrierNode
1087
1094
or
1088
1095
config .isSink ( node )
1089
1096
}
@@ -1127,14 +1134,14 @@ private module LocalFlowBigStep {
1127
1134
exists ( Node mid |
1128
1135
localFlowStepPlus ( node1 , mid , preservesValue , t , config , cc ) and
1129
1136
localFlowStepNodeCand1 ( mid , node2 , config ) and
1130
- not mid instanceof CastNode and
1137
+ not mid instanceof BigStepBarrierNode and
1131
1138
nodeCand2 ( node2 , unbind ( config ) )
1132
1139
)
1133
1140
or
1134
1141
exists ( Node mid |
1135
1142
localFlowStepPlus ( node1 , mid , _, _, config , cc ) and
1136
1143
additionalLocalFlowStepNodeCand2 ( mid , node2 , config ) and
1137
- not mid instanceof CastNode and
1144
+ not mid instanceof BigStepBarrierNode and
1138
1145
preservesValue = false and
1139
1146
t = getErasedNodeTypeBound ( node2 ) and
1140
1147
nodeCand2 ( node2 , unbind ( config ) )
@@ -1208,7 +1215,8 @@ private predicate flowCandFwd0(
1208
1215
or
1209
1216
exists ( Node mid |
1210
1217
flowCandFwd ( mid , fromArg , argApf , apf , config ) and
1211
- localFlowBigStep ( mid , node , true , _, config , _)
1218
+ localFlowBigStep ( mid , node , true , _, config , _) and
1219
+ not apf .isClearedAt ( node )
1212
1220
)
1213
1221
or
1214
1222
exists ( Node mid , AccessPathFrontNil nil |
@@ -1221,7 +1229,8 @@ private predicate flowCandFwd0(
1221
1229
nodeCand2 ( node , unbind ( config ) ) and
1222
1230
jumpStep ( mid , node , config ) and
1223
1231
fromArg = false and
1224
- argApf = TAccessPathFrontNone ( )
1232
+ argApf = TAccessPathFrontNone ( ) and
1233
+ not apf .isClearedAt ( node )
1225
1234
)
1226
1235
or
1227
1236
exists ( Node mid , AccessPathFrontNil nil |
@@ -1246,7 +1255,8 @@ private predicate flowCandFwd0(
1246
1255
exists ( TypedContent tc |
1247
1256
flowCandFwdRead ( tc , node , fromArg , argApf , config ) and
1248
1257
flowCandFwdConsCand ( tc , apf , config ) and
1249
- nodeCand2 ( node , _, _, unbindBool ( apf .toBoolNonEmpty ( ) ) , unbind ( config ) )
1258
+ nodeCand2 ( node , _, _, unbindBool ( apf .toBoolNonEmpty ( ) ) , unbind ( config ) ) and
1259
+ not apf .isClearedAt ( node )
1250
1260
)
1251
1261
or
1252
1262
// flow into a callable
@@ -1302,7 +1312,8 @@ private predicate flowCandFwdIn(
1302
1312
) {
1303
1313
exists ( ArgumentNode arg , boolean allowsFieldFlow |
1304
1314
flowCandFwd ( arg , fromArg , argApf , apf , config ) and
1305
- flowIntoCallNodeCand2 ( call , arg , p , allowsFieldFlow , config )
1315
+ flowIntoCallNodeCand2 ( call , arg , p , allowsFieldFlow , config ) and
1316
+ not apf .isClearedAt ( p )
1306
1317
|
1307
1318
apf instanceof AccessPathFrontNil or allowsFieldFlow = true
1308
1319
)
@@ -1315,7 +1326,8 @@ private predicate flowCandFwdOut(
1315
1326
) {
1316
1327
exists ( ReturnNodeExt ret , boolean allowsFieldFlow |
1317
1328
flowCandFwd ( ret , fromArg , argApf , apf , config ) and
1318
- flowOutOfCallNodeCand2 ( call , ret , node , allowsFieldFlow , config )
1329
+ flowOutOfCallNodeCand2 ( call , ret , node , allowsFieldFlow , config ) and
1330
+ not apf .isClearedAt ( node )
1319
1331
|
1320
1332
apf instanceof AccessPathFrontNil or allowsFieldFlow = true
1321
1333
)
0 commit comments