@@ -4004,17 +4004,18 @@ module Impl<FullStateConfigSig Config> {
4004
4004
private newtype TPartialPathNode =
4005
4005
TPartialPathNodeFwd (
4006
4006
NodeEx node , FlowState state , CallContext cc , TSummaryCtx1 sc1 , TSummaryCtx2 sc2 ,
4007
- TSummaryCtx3 sc3 , PartialAccessPath ap
4007
+ TSummaryCtx3 sc3 , DataFlowType t , PartialAccessPath ap
4008
4008
) {
4009
4009
sourceNode ( node , state ) and
4010
4010
cc instanceof CallContextAny and
4011
4011
sc1 = TSummaryCtx1None ( ) and
4012
4012
sc2 = TSummaryCtx2None ( ) and
4013
4013
sc3 = TSummaryCtx3None ( ) and
4014
+ t = node .getDataFlowType ( ) and
4014
4015
ap = TPartialNil ( node .getDataFlowType ( ) ) and
4015
4016
exists ( explorationLimit ( ) )
4016
4017
or
4017
- partialPathNodeMk0 ( node , state , cc , sc1 , sc2 , sc3 , ap ) and
4018
+ partialPathNodeMk0 ( node , state , cc , sc1 , sc2 , sc3 , t , ap ) and
4018
4019
distSrc ( node .getEnclosingCallable ( ) ) <= explorationLimit ( )
4019
4020
} or
4020
4021
TPartialPathNodeRev (
@@ -4042,9 +4043,9 @@ module Impl<FullStateConfigSig Config> {
4042
4043
pragma [ nomagic]
4043
4044
private predicate partialPathNodeMk0 (
4044
4045
NodeEx node , FlowState state , CallContext cc , TSummaryCtx1 sc1 , TSummaryCtx2 sc2 ,
4045
- TSummaryCtx3 sc3 , PartialAccessPath ap
4046
+ TSummaryCtx3 sc3 , DataFlowType t , PartialAccessPath ap
4046
4047
) {
4047
- partialPathStep ( _, node , state , cc , sc1 , sc2 , sc3 , ap ) and
4048
+ partialPathStep ( _, node , state , cc , sc1 , sc2 , sc3 , t , ap ) and
4048
4049
not fullBarrier ( node ) and
4049
4050
not stateBarrier ( node , state ) and
4050
4051
not clearsContentEx ( node , ap .getHead ( ) .getContent ( ) ) and
@@ -4053,7 +4054,7 @@ module Impl<FullStateConfigSig Config> {
4053
4054
expectsContentEx ( node , ap .getHead ( ) .getContent ( ) )
4054
4055
) and
4055
4056
if node .asNode ( ) instanceof CastingNode
4056
- then compatibleTypes ( node .getDataFlowType ( ) , ap . getType ( ) )
4057
+ then compatibleTypes ( node .getDataFlowType ( ) , t )
4057
4058
else any ( )
4058
4059
}
4059
4060
@@ -4113,11 +4114,7 @@ module Impl<FullStateConfigSig Config> {
4113
4114
private string ppType ( ) {
4114
4115
this instanceof PartialPathNodeRev and result = ""
4115
4116
or
4116
- this .( PartialPathNodeFwd ) .getAp ( ) instanceof PartialAccessPathNil and result = ""
4117
- or
4118
- exists ( DataFlowType t |
4119
- t = this .( PartialPathNodeFwd ) .getAp ( ) .( PartialAccessPathCons ) .getType ( )
4120
- |
4117
+ exists ( DataFlowType t | t = this .( PartialPathNodeFwd ) .getType ( ) |
4121
4118
// The `concat` becomes "" if `ppReprType` has no result.
4122
4119
result = concat ( " : " + ppReprType ( t ) )
4123
4120
)
@@ -4158,9 +4155,10 @@ module Impl<FullStateConfigSig Config> {
4158
4155
TSummaryCtx1 sc1 ;
4159
4156
TSummaryCtx2 sc2 ;
4160
4157
TSummaryCtx3 sc3 ;
4158
+ DataFlowType t ;
4161
4159
PartialAccessPath ap ;
4162
4160
4163
- PartialPathNodeFwd ( ) { this = TPartialPathNodeFwd ( node , state , cc , sc1 , sc2 , sc3 , ap ) }
4161
+ PartialPathNodeFwd ( ) { this = TPartialPathNodeFwd ( node , state , cc , sc1 , sc2 , sc3 , t , ap ) }
4164
4162
4165
4163
NodeEx getNodeEx ( ) { result = node }
4166
4164
@@ -4174,11 +4172,13 @@ module Impl<FullStateConfigSig Config> {
4174
4172
4175
4173
TSummaryCtx3 getSummaryCtx3 ( ) { result = sc3 }
4176
4174
4175
+ DataFlowType getType ( ) { result = t }
4176
+
4177
4177
PartialAccessPath getAp ( ) { result = ap }
4178
4178
4179
4179
override PartialPathNodeFwd getASuccessor ( ) {
4180
4180
partialPathStep ( this , result .getNodeEx ( ) , result .getState ( ) , result .getCallContext ( ) ,
4181
- result .getSummaryCtx1 ( ) , result .getSummaryCtx2 ( ) , result .getSummaryCtx3 ( ) , result .getAp ( ) )
4181
+ result .getSummaryCtx1 ( ) , result .getSummaryCtx2 ( ) , result .getSummaryCtx3 ( ) , result .getType ( ) , result . getAp ( ) )
4182
4182
}
4183
4183
4184
4184
predicate isSource ( ) {
@@ -4229,7 +4229,7 @@ module Impl<FullStateConfigSig Config> {
4229
4229
4230
4230
private predicate partialPathStep (
4231
4231
PartialPathNodeFwd mid , NodeEx node , FlowState state , CallContext cc , TSummaryCtx1 sc1 ,
4232
- TSummaryCtx2 sc2 , TSummaryCtx3 sc3 , PartialAccessPath ap
4232
+ TSummaryCtx2 sc2 , TSummaryCtx3 sc3 , DataFlowType t , PartialAccessPath ap
4233
4233
) {
4234
4234
not isUnreachableInCallCached ( node .asNode ( ) , cc .( CallContextSpecificCall ) .getCall ( ) ) and
4235
4235
(
@@ -4239,6 +4239,7 @@ module Impl<FullStateConfigSig Config> {
4239
4239
sc1 = mid .getSummaryCtx1 ( ) and
4240
4240
sc2 = mid .getSummaryCtx2 ( ) and
4241
4241
sc3 = mid .getSummaryCtx3 ( ) and
4242
+ t = mid .getType ( ) and
4242
4243
ap = mid .getAp ( )
4243
4244
or
4244
4245
additionalLocalFlowStep ( mid .getNodeEx ( ) , node ) and
@@ -4248,6 +4249,7 @@ module Impl<FullStateConfigSig Config> {
4248
4249
sc2 = mid .getSummaryCtx2 ( ) and
4249
4250
sc3 = mid .getSummaryCtx3 ( ) and
4250
4251
mid .getAp ( ) instanceof PartialAccessPathNil and
4252
+ t = node .getDataFlowType ( ) and
4251
4253
ap = TPartialNil ( node .getDataFlowType ( ) )
4252
4254
or
4253
4255
additionalLocalStateStep ( mid .getNodeEx ( ) , mid .getState ( ) , node , state ) and
@@ -4256,6 +4258,7 @@ module Impl<FullStateConfigSig Config> {
4256
4258
sc2 = mid .getSummaryCtx2 ( ) and
4257
4259
sc3 = mid .getSummaryCtx3 ( ) and
4258
4260
mid .getAp ( ) instanceof PartialAccessPathNil and
4261
+ t = node .getDataFlowType ( ) and
4259
4262
ap = TPartialNil ( node .getDataFlowType ( ) )
4260
4263
)
4261
4264
or
@@ -4265,6 +4268,7 @@ module Impl<FullStateConfigSig Config> {
4265
4268
sc1 = TSummaryCtx1None ( ) and
4266
4269
sc2 = TSummaryCtx2None ( ) and
4267
4270
sc3 = TSummaryCtx3None ( ) and
4271
+ t = mid .getType ( ) and
4268
4272
ap = mid .getAp ( )
4269
4273
or
4270
4274
additionalJumpStep ( mid .getNodeEx ( ) , node ) and
@@ -4274,6 +4278,7 @@ module Impl<FullStateConfigSig Config> {
4274
4278
sc2 = TSummaryCtx2None ( ) and
4275
4279
sc3 = TSummaryCtx3None ( ) and
4276
4280
mid .getAp ( ) instanceof PartialAccessPathNil and
4281
+ t = node .getDataFlowType ( ) and
4277
4282
ap = TPartialNil ( node .getDataFlowType ( ) )
4278
4283
or
4279
4284
additionalJumpStateStep ( mid .getNodeEx ( ) , mid .getState ( ) , node , state ) and
@@ -4282,32 +4287,33 @@ module Impl<FullStateConfigSig Config> {
4282
4287
sc2 = TSummaryCtx2None ( ) and
4283
4288
sc3 = TSummaryCtx3None ( ) and
4284
4289
mid .getAp ( ) instanceof PartialAccessPathNil and
4290
+ t = node .getDataFlowType ( ) and
4285
4291
ap = TPartialNil ( node .getDataFlowType ( ) )
4286
4292
or
4287
- partialPathStoreStep ( mid , _, _, node , ap ) and
4293
+ partialPathStoreStep ( mid , _, _, _ , node , t , ap ) and
4288
4294
state = mid .getState ( ) and
4289
4295
cc = mid .getCallContext ( ) and
4290
4296
sc1 = mid .getSummaryCtx1 ( ) and
4291
4297
sc2 = mid .getSummaryCtx2 ( ) and
4292
4298
sc3 = mid .getSummaryCtx3 ( )
4293
4299
or
4294
- exists ( PartialAccessPath ap0 , TypedContent tc |
4295
- partialPathReadStep ( mid , ap0 , tc , node , cc ) and
4300
+ exists ( DataFlowType t0 , PartialAccessPath ap0 , Content c |
4301
+ partialPathReadStep ( mid , t0 , ap0 , c , node , cc ) and
4296
4302
state = mid .getState ( ) and
4297
4303
sc1 = mid .getSummaryCtx1 ( ) and
4298
4304
sc2 = mid .getSummaryCtx2 ( ) and
4299
4305
sc3 = mid .getSummaryCtx3 ( ) and
4300
- apConsFwd ( ap , tc , ap0 )
4306
+ apConsFwd ( t , ap , c , t0 , ap0 )
4301
4307
)
4302
4308
or
4303
- partialPathIntoCallable ( mid , node , state , _, cc , sc1 , sc2 , sc3 , _, ap )
4309
+ partialPathIntoCallable ( mid , node , state , _, cc , sc1 , sc2 , sc3 , _, t , ap )
4304
4310
or
4305
- partialPathOutOfCallable ( mid , node , state , cc , ap ) and
4311
+ partialPathOutOfCallable ( mid , node , state , cc , t , ap ) and
4306
4312
sc1 = TSummaryCtx1None ( ) and
4307
4313
sc2 = TSummaryCtx2None ( ) and
4308
4314
sc3 = TSummaryCtx3None ( )
4309
4315
or
4310
- partialPathThroughCallable ( mid , node , state , cc , ap ) and
4316
+ partialPathThroughCallable ( mid , node , state , cc , t , ap ) and
4311
4317
sc1 = mid .getSummaryCtx1 ( ) and
4312
4318
sc2 = mid .getSummaryCtx2 ( ) and
4313
4319
sc3 = mid .getSummaryCtx3 ( )
@@ -4318,55 +4324,58 @@ module Impl<FullStateConfigSig Config> {
4318
4324
4319
4325
pragma [ inline]
4320
4326
private predicate partialPathStoreStep (
4321
- PartialPathNodeFwd mid , PartialAccessPath ap1 , TypedContent tc , NodeEx node ,
4322
- PartialAccessPath ap2
4327
+ PartialPathNodeFwd mid , DataFlowType t1 , PartialAccessPath ap1 , Content c , NodeEx node ,
4328
+ DataFlowType t2 , PartialAccessPath ap2
4323
4329
) {
4324
- exists ( NodeEx midNode , DataFlowType contentType |
4330
+ exists ( NodeEx midNode , DataFlowType contentType , TypedContent tc |
4325
4331
midNode = mid .getNodeEx ( ) and
4332
+ t1 = mid .getType ( ) and
4326
4333
ap1 = mid .getAp ( ) and
4327
- storeEx ( midNode , tc , _ , node , contentType , _ ) and
4334
+ storeEx ( midNode , tc , c , node , contentType , t2 ) and
4328
4335
ap2 .getHead ( ) = tc and
4329
4336
ap2 .len ( ) = unbindInt ( ap1 .len ( ) + 1 ) and
4330
- compatibleTypes ( ap1 . getType ( ) , contentType )
4337
+ compatibleTypes ( t1 , contentType )
4331
4338
)
4332
4339
}
4333
4340
4334
4341
pragma [ nomagic]
4335
- private predicate apConsFwd ( PartialAccessPath ap1 , TypedContent tc , PartialAccessPath ap2 ) {
4336
- partialPathStoreStep ( _, ap1 , tc , _, ap2 )
4342
+ private predicate apConsFwd ( DataFlowType t1 , PartialAccessPath ap1 , Content c , DataFlowType t2 , PartialAccessPath ap2 ) {
4343
+ partialPathStoreStep ( _, t1 , ap1 , c , _, t2 , ap2 )
4337
4344
}
4338
4345
4339
4346
pragma [ nomagic]
4340
4347
private predicate partialPathReadStep (
4341
- PartialPathNodeFwd mid , PartialAccessPath ap , TypedContent tc , NodeEx node , CallContext cc
4348
+ PartialPathNodeFwd mid , DataFlowType t , PartialAccessPath ap , Content c , NodeEx node , CallContext cc
4342
4349
) {
4343
4350
exists ( NodeEx midNode |
4344
4351
midNode = mid .getNodeEx ( ) and
4352
+ t = mid .getType ( ) and
4345
4353
ap = mid .getAp ( ) and
4346
- read ( midNode , tc . getContent ( ) , node ) and
4347
- ap .getHead ( ) = tc and
4354
+ read ( midNode , c , node ) and
4355
+ ap .getHead ( ) . getContent ( ) = c and
4348
4356
cc = mid .getCallContext ( )
4349
4357
)
4350
4358
}
4351
4359
4352
4360
private predicate partialPathOutOfCallable0 (
4353
4361
PartialPathNodeFwd mid , ReturnPosition pos , FlowState state , CallContext innercc ,
4354
- PartialAccessPath ap
4362
+ DataFlowType t , PartialAccessPath ap
4355
4363
) {
4356
4364
pos = mid .getNodeEx ( ) .( RetNodeEx ) .getReturnPosition ( ) and
4357
4365
state = mid .getState ( ) and
4358
4366
innercc = mid .getCallContext ( ) and
4359
4367
innercc instanceof CallContextNoCall and
4368
+ t = mid .getType ( ) and
4360
4369
ap = mid .getAp ( )
4361
4370
}
4362
4371
4363
4372
pragma [ nomagic]
4364
4373
private predicate partialPathOutOfCallable1 (
4365
4374
PartialPathNodeFwd mid , DataFlowCall call , ReturnKindExt kind , FlowState state ,
4366
- CallContext cc , PartialAccessPath ap
4375
+ CallContext cc , DataFlowType t , PartialAccessPath ap
4367
4376
) {
4368
4377
exists ( ReturnPosition pos , DataFlowCallable c , CallContext innercc |
4369
- partialPathOutOfCallable0 ( mid , pos , state , innercc , ap ) and
4378
+ partialPathOutOfCallable0 ( mid , pos , state , innercc , t , ap ) and
4370
4379
c = pos .getCallable ( ) and
4371
4380
kind = pos .getKind ( ) and
4372
4381
resolveReturn ( innercc , c , call )
@@ -4376,10 +4385,10 @@ module Impl<FullStateConfigSig Config> {
4376
4385
}
4377
4386
4378
4387
private predicate partialPathOutOfCallable (
4379
- PartialPathNodeFwd mid , NodeEx out , FlowState state , CallContext cc , PartialAccessPath ap
4388
+ PartialPathNodeFwd mid , NodeEx out , FlowState state , CallContext cc , DataFlowType t , PartialAccessPath ap
4380
4389
) {
4381
4390
exists ( ReturnKindExt kind , DataFlowCall call |
4382
- partialPathOutOfCallable1 ( mid , call , kind , state , cc , ap )
4391
+ partialPathOutOfCallable1 ( mid , call , kind , state , cc , t , ap )
4383
4392
|
4384
4393
out .asNode ( ) = kind .getAnOutNode ( call )
4385
4394
)
@@ -4388,13 +4397,14 @@ module Impl<FullStateConfigSig Config> {
4388
4397
pragma [ noinline]
4389
4398
private predicate partialPathIntoArg (
4390
4399
PartialPathNodeFwd mid , ParameterPosition ppos , FlowState state , CallContext cc ,
4391
- DataFlowCall call , PartialAccessPath ap
4400
+ DataFlowCall call , DataFlowType t , PartialAccessPath ap
4392
4401
) {
4393
4402
exists ( ArgNode arg , ArgumentPosition apos |
4394
4403
arg = mid .getNodeEx ( ) .asNode ( ) and
4395
4404
state = mid .getState ( ) and
4396
4405
cc = mid .getCallContext ( ) and
4397
4406
arg .argumentOf ( call , apos ) and
4407
+ t = mid .getType ( ) and
4398
4408
ap = mid .getAp ( ) and
4399
4409
parameterMatch ( ppos , apos )
4400
4410
)
@@ -4403,19 +4413,19 @@ module Impl<FullStateConfigSig Config> {
4403
4413
pragma [ nomagic]
4404
4414
private predicate partialPathIntoCallable0 (
4405
4415
PartialPathNodeFwd mid , DataFlowCallable callable , ParameterPosition pos , FlowState state ,
4406
- CallContext outercc , DataFlowCall call , PartialAccessPath ap
4416
+ CallContext outercc , DataFlowCall call , DataFlowType t , PartialAccessPath ap
4407
4417
) {
4408
- partialPathIntoArg ( mid , pos , state , outercc , call , ap ) and
4418
+ partialPathIntoArg ( mid , pos , state , outercc , call , t , ap ) and
4409
4419
callable = resolveCall ( call , outercc )
4410
4420
}
4411
4421
4412
4422
private predicate partialPathIntoCallable (
4413
4423
PartialPathNodeFwd mid , ParamNodeEx p , FlowState state , CallContext outercc ,
4414
4424
CallContextCall innercc , TSummaryCtx1 sc1 , TSummaryCtx2 sc2 , TSummaryCtx3 sc3 ,
4415
- DataFlowCall call , PartialAccessPath ap
4425
+ DataFlowCall call , DataFlowType t , PartialAccessPath ap
4416
4426
) {
4417
4427
exists ( ParameterPosition pos , DataFlowCallable callable |
4418
- partialPathIntoCallable0 ( mid , callable , pos , state , outercc , call , ap ) and
4428
+ partialPathIntoCallable0 ( mid , callable , pos , state , outercc , call , t , ap ) and
4419
4429
p .isParameterOf ( callable , pos ) and
4420
4430
sc1 = TSummaryCtx1Param ( p ) and
4421
4431
sc2 = TSummaryCtx2Some ( state ) and
@@ -4430,7 +4440,7 @@ module Impl<FullStateConfigSig Config> {
4430
4440
pragma [ nomagic]
4431
4441
private predicate paramFlowsThroughInPartialPath (
4432
4442
ReturnKindExt kind , FlowState state , CallContextCall cc , TSummaryCtx1 sc1 , TSummaryCtx2 sc2 ,
4433
- TSummaryCtx3 sc3 , PartialAccessPath ap
4443
+ TSummaryCtx3 sc3 , DataFlowType t , PartialAccessPath ap
4434
4444
) {
4435
4445
exists ( PartialPathNodeFwd mid , RetNodeEx ret |
4436
4446
mid .getNodeEx ( ) = ret and
@@ -4440,26 +4450,27 @@ module Impl<FullStateConfigSig Config> {
4440
4450
sc1 = mid .getSummaryCtx1 ( ) and
4441
4451
sc2 = mid .getSummaryCtx2 ( ) and
4442
4452
sc3 = mid .getSummaryCtx3 ( ) and
4453
+ t = mid .getType ( ) and
4443
4454
ap = mid .getAp ( )
4444
4455
)
4445
4456
}
4446
4457
4447
4458
pragma [ noinline]
4448
4459
private predicate partialPathThroughCallable0 (
4449
4460
DataFlowCall call , PartialPathNodeFwd mid , ReturnKindExt kind , FlowState state ,
4450
- CallContext cc , PartialAccessPath ap
4461
+ CallContext cc , DataFlowType t , PartialAccessPath ap
4451
4462
) {
4452
4463
exists ( CallContext innercc , TSummaryCtx1 sc1 , TSummaryCtx2 sc2 , TSummaryCtx3 sc3 |
4453
- partialPathIntoCallable ( mid , _, _, cc , innercc , sc1 , sc2 , sc3 , call , _) and
4454
- paramFlowsThroughInPartialPath ( kind , state , innercc , sc1 , sc2 , sc3 , ap )
4464
+ partialPathIntoCallable ( mid , _, _, cc , innercc , sc1 , sc2 , sc3 , call , _, _ ) and
4465
+ paramFlowsThroughInPartialPath ( kind , state , innercc , sc1 , sc2 , sc3 , t , ap )
4455
4466
)
4456
4467
}
4457
4468
4458
4469
private predicate partialPathThroughCallable (
4459
- PartialPathNodeFwd mid , NodeEx out , FlowState state , CallContext cc , PartialAccessPath ap
4470
+ PartialPathNodeFwd mid , NodeEx out , FlowState state , CallContext cc , DataFlowType t , PartialAccessPath ap
4460
4471
) {
4461
4472
exists ( DataFlowCall call , ReturnKindExt kind |
4462
- partialPathThroughCallable0 ( call , mid , kind , state , cc , ap ) and
4473
+ partialPathThroughCallable0 ( call , mid , kind , state , cc , t , ap ) and
4463
4474
out .asNode ( ) = kind .getAnOutNode ( call )
4464
4475
)
4465
4476
}
0 commit comments