Skip to content

Commit 2e86bbd

Browse files
committed
Java: Introduce helper predicate to avoid empty predicate in IPA branch.
1 parent a9e5b34 commit 2e86bbd

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

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

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,10 @@ module Impl<FullStateConfigSig Config> {
418418
)
419419
}
420420

421+
private predicate sourceCallCtx(CallContext cc) {
422+
if hasSourceCallCtx() then cc instanceof CallContextSomeCall else cc instanceof CallContextAny
423+
}
424+
421425
private predicate hasSinkCallCtx() {
422426
exists(FlowFeature feature | feature = Config::getAFeature() |
423427
feature instanceof FeatureHasSinkCallContext or
@@ -2804,11 +2808,7 @@ module Impl<FullStateConfigSig Config> {
28042808
// A PathNode is introduced by a source ...
28052809
Stage5::revFlow(node, state) and
28062810
sourceNode(node, state) and
2807-
(
2808-
if hasSourceCallCtx()
2809-
then cc instanceof CallContextSomeCall
2810-
else cc instanceof CallContextAny
2811-
) and
2811+
sourceCallCtx(cc) and
28122812
sc instanceof SummaryCtxNone and
28132813
ap = TAccessPathNil(node.getDataFlowType())
28142814
or
@@ -3214,11 +3214,7 @@ module Impl<FullStateConfigSig Config> {
32143214

32153215
override predicate isSource() {
32163216
sourceNode(node, state) and
3217-
(
3218-
if hasSourceCallCtx()
3219-
then cc instanceof CallContextSomeCall
3220-
else cc instanceof CallContextAny
3221-
) and
3217+
sourceCallCtx(cc) and
32223218
sc instanceof SummaryCtxNone and
32233219
ap = TAccessPathNil(node.getDataFlowType())
32243220
}

0 commit comments

Comments
 (0)