Skip to content

Commit a8545f2

Browse files
committed
Wip: test changes to fieldflowbranchlimit semantics
1 parent f4ef434 commit a8545f2

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

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

+22-16
Original file line numberDiff line numberDiff line change
@@ -1111,10 +1111,11 @@ private predicate flowOutOfCallNodeCand1(
11111111
DataFlowCall call, RetNodeEx ret, NodeEx out, boolean allowsFieldFlow, Configuration config
11121112
) {
11131113
flowOutOfCallNodeCand1(call, ret, out, config) and
1114-
exists(int b, int j |
1115-
b = branch(ret, config) and
1114+
exists(int j | //int b,
1115+
//b = branch(ret, config) and
11161116
j = join(out, config) and
1117-
if b.minimum(j) <= config.fieldFlowBranchLimit()
1117+
// if b.minimum(j) <= config.fieldFlowBranchLimit()
1118+
if j <= config.fieldFlowBranchLimit()
11181119
then allowsFieldFlow = true
11191120
else allowsFieldFlow = false
11201121
)
@@ -1130,10 +1131,11 @@ private predicate flowIntoCallNodeCand1(
11301131
DataFlowCall call, ArgNodeEx arg, ParamNodeEx p, boolean allowsFieldFlow, Configuration config
11311132
) {
11321133
flowIntoCallNodeCand1(call, arg, p, config) and
1133-
exists(int b, int j |
1134+
exists(int b | //, int j |
11341135
b = branch(arg, config) and
1135-
j = join(p, config) and
1136-
if b.minimum(j) <= config.fieldFlowBranchLimit()
1136+
// j = join(p, config) and
1137+
// if b.minimum(j) <= config.fieldFlowBranchLimit()
1138+
if b <= config.fieldFlowBranchLimit()
11371139
then allowsFieldFlow = true
11381140
else allowsFieldFlow = false
11391141
)
@@ -1383,8 +1385,9 @@ private module MkStage<StageSig PrevStage> {
13831385
exists(ArgNodeEx arg, boolean allowsFieldFlow |
13841386
fwdFlow(arg, state, outercc, argAp, ap, config) and
13851387
flowIntoCall(call, arg, p, allowsFieldFlow, config) and
1386-
innercc = getCallContextCall(call, p.getEnclosingCallable(), outercc) and
1387-
if allowsFieldFlow = false then ap instanceof ApNil else any()
1388+
innercc = getCallContextCall(call, p.getEnclosingCallable(), outercc)
1389+
// and
1390+
// if allowsFieldFlow = false then ap instanceof ApNil else any()
13881391
)
13891392
}
13901393

@@ -1399,8 +1402,9 @@ private module MkStage<StageSig PrevStage> {
13991402
fwdFlow(ret, state, innercc, argAp, ap, config) and
14001403
flowOutOfCall(call, ret, out, allowsFieldFlow, config) and
14011404
inner = ret.getEnclosingCallable() and
1402-
ccOut = getCallContextReturn(inner, call, innercc) and
1403-
if allowsFieldFlow = false then ap instanceof ApNil else any()
1405+
ccOut = getCallContextReturn(inner, call, innercc)
1406+
// and
1407+
// if allowsFieldFlow = false then ap instanceof ApNil else any()
14041408
)
14051409
}
14061410

@@ -1411,7 +1415,7 @@ private module MkStage<StageSig PrevStage> {
14111415
exists(RetNodeEx ret, boolean allowsFieldFlow, CcCall ccc |
14121416
fwdFlow(ret, state, ccc, apSome(argAp), ap, config) and
14131417
flowThroughOutOfCall(call, ccc, ret, out, allowsFieldFlow, config) and
1414-
if allowsFieldFlow = false then ap instanceof ApNil else any()
1418+
if allowsFieldFlow = false then ap instanceof ApNil and argAp instanceof ApNil else any()
14151419
)
14161420
}
14171421

@@ -1597,8 +1601,9 @@ private module MkStage<StageSig PrevStage> {
15971601
) {
15981602
exists(NodeEx out, boolean allowsFieldFlow |
15991603
revFlow(out, state, toReturn, returnAp, ap, config) and
1600-
flowOutOfCall(call, ret, out, allowsFieldFlow, config) and
1601-
if allowsFieldFlow = false then ap instanceof ApNil else any()
1604+
flowOutOfCall(call, ret, out, allowsFieldFlow, config)
1605+
// and
1606+
// if allowsFieldFlow = false then ap instanceof ApNil else any()
16021607
)
16031608
}
16041609

@@ -1608,8 +1613,9 @@ private module MkStage<StageSig PrevStage> {
16081613
) {
16091614
exists(ParamNodeEx p, boolean allowsFieldFlow |
16101615
revFlow(p, state, false, returnAp, ap, config) and
1611-
flowIntoCall(_, arg, p, allowsFieldFlow, config) and
1612-
if allowsFieldFlow = false then ap instanceof ApNil else any()
1616+
flowIntoCall(_, arg, p, allowsFieldFlow, config)
1617+
// and
1618+
// if allowsFieldFlow = false then ap instanceof ApNil else any()
16131619
)
16141620
}
16151621

@@ -1620,7 +1626,7 @@ private module MkStage<StageSig PrevStage> {
16201626
exists(ParamNodeEx p, boolean allowsFieldFlow |
16211627
revFlow(p, state, true, apSome(returnAp), ap, config) and
16221628
flowThroughIntoCall(call, arg, p, allowsFieldFlow, config) and
1623-
if allowsFieldFlow = false then ap instanceof ApNil else any()
1629+
if allowsFieldFlow = false then ap instanceof ApNil and returnAp instanceof ApNil else any()
16241630
)
16251631
}
16261632

0 commit comments

Comments
 (0)