Skip to content

Wip: test changes to fieldflowbranchlimit semantics #10025

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 22 additions & 16 deletions java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImpl.qll
Original file line number Diff line number Diff line change
Expand Up @@ -1112,10 +1112,11 @@ private predicate flowOutOfCallNodeCand1(
DataFlowCall call, RetNodeEx ret, NodeEx out, boolean allowsFieldFlow, Configuration config
) {
flowOutOfCallNodeCand1(call, ret, out, config) and
exists(int b, int j |
b = branch(ret, config) and
exists(int j | //int b,
//b = branch(ret, config) and
j = join(out, config) and
if b.minimum(j) <= config.fieldFlowBranchLimit()
// if b.minimum(j) <= config.fieldFlowBranchLimit()
if j <= config.fieldFlowBranchLimit()
then allowsFieldFlow = true
else allowsFieldFlow = false
)
Expand All @@ -1131,10 +1132,11 @@ private predicate flowIntoCallNodeCand1(
DataFlowCall call, ArgNodeEx arg, ParamNodeEx p, boolean allowsFieldFlow, Configuration config
) {
flowIntoCallNodeCand1(call, arg, p, config) and
exists(int b, int j |
exists(int b | //, int j |
b = branch(arg, config) and
j = join(p, config) and
if b.minimum(j) <= config.fieldFlowBranchLimit()
// j = join(p, config) and
// if b.minimum(j) <= config.fieldFlowBranchLimit()
if b <= config.fieldFlowBranchLimit()
then allowsFieldFlow = true
else allowsFieldFlow = false
)
Expand Down Expand Up @@ -1384,8 +1386,9 @@ private module MkStage<StageSig PrevStage> {
exists(ArgNodeEx arg, boolean allowsFieldFlow |
fwdFlow(arg, state, outercc, argAp, ap, config) and
flowIntoCall(call, arg, p, allowsFieldFlow, config) and
innercc = getCallContextCall(call, p.getEnclosingCallable(), outercc) and
if allowsFieldFlow = false then ap instanceof ApNil else any()
innercc = getCallContextCall(call, p.getEnclosingCallable(), outercc)
// and
// if allowsFieldFlow = false then ap instanceof ApNil else any()
)
}

Expand All @@ -1400,8 +1403,9 @@ private module MkStage<StageSig PrevStage> {
fwdFlow(ret, state, innercc, argAp, ap, config) and
flowOutOfCall(call, ret, out, allowsFieldFlow, config) and
inner = ret.getEnclosingCallable() and
ccOut = getCallContextReturn(inner, call, innercc) and
if allowsFieldFlow = false then ap instanceof ApNil else any()
ccOut = getCallContextReturn(inner, call, innercc)
// and
// if allowsFieldFlow = false then ap instanceof ApNil else any()
)
}

Expand All @@ -1412,7 +1416,7 @@ private module MkStage<StageSig PrevStage> {
exists(RetNodeEx ret, boolean allowsFieldFlow, CcCall ccc |
fwdFlow(ret, state, ccc, apSome(argAp), ap, config) and
flowThroughOutOfCall(call, ccc, ret, out, allowsFieldFlow, config) and
if allowsFieldFlow = false then ap instanceof ApNil else any()
if allowsFieldFlow = false then ap instanceof ApNil and argAp instanceof ApNil else any()
)
}

Expand Down Expand Up @@ -1598,8 +1602,9 @@ private module MkStage<StageSig PrevStage> {
) {
exists(NodeEx out, boolean allowsFieldFlow |
revFlow(out, state, toReturn, returnAp, ap, config) and
flowOutOfCall(call, ret, out, allowsFieldFlow, config) and
if allowsFieldFlow = false then ap instanceof ApNil else any()
flowOutOfCall(call, ret, out, allowsFieldFlow, config)
// and
// if allowsFieldFlow = false then ap instanceof ApNil else any()
)
}

Expand All @@ -1609,8 +1614,9 @@ private module MkStage<StageSig PrevStage> {
) {
exists(ParamNodeEx p, boolean allowsFieldFlow |
revFlow(p, state, false, returnAp, ap, config) and
flowIntoCall(_, arg, p, allowsFieldFlow, config) and
if allowsFieldFlow = false then ap instanceof ApNil else any()
flowIntoCall(_, arg, p, allowsFieldFlow, config)
// and
// if allowsFieldFlow = false then ap instanceof ApNil else any()
)
}

Expand All @@ -1621,7 +1627,7 @@ private module MkStage<StageSig PrevStage> {
exists(ParamNodeEx p, boolean allowsFieldFlow |
revFlow(p, state, true, apSome(returnAp), ap, config) and
flowThroughIntoCall(call, arg, p, allowsFieldFlow, config) and
if allowsFieldFlow = false then ap instanceof ApNil else any()
if allowsFieldFlow = false then ap instanceof ApNil and returnAp instanceof ApNil else any()
)
}

Expand Down