Java: Introduce helper predicate to avoid empty predicate in IPA branch.

This commit is contained in:
Michael Nebel
2023-03-15 16:51:35 +01:00
parent a9e5b34ad6
commit 2e86bbd6cd

View File

@@ -418,6 +418,10 @@ module Impl<FullStateConfigSig Config> {
) )
} }
private predicate sourceCallCtx(CallContext cc) {
if hasSourceCallCtx() then cc instanceof CallContextSomeCall else cc instanceof CallContextAny
}
private predicate hasSinkCallCtx() { private predicate hasSinkCallCtx() {
exists(FlowFeature feature | feature = Config::getAFeature() | exists(FlowFeature feature | feature = Config::getAFeature() |
feature instanceof FeatureHasSinkCallContext or feature instanceof FeatureHasSinkCallContext or
@@ -2804,11 +2808,7 @@ module Impl<FullStateConfigSig Config> {
// A PathNode is introduced by a source ... // A PathNode is introduced by a source ...
Stage5::revFlow(node, state) and Stage5::revFlow(node, state) and
sourceNode(node, state) and sourceNode(node, state) and
( sourceCallCtx(cc) and
if hasSourceCallCtx()
then cc instanceof CallContextSomeCall
else cc instanceof CallContextAny
) and
sc instanceof SummaryCtxNone and sc instanceof SummaryCtxNone and
ap = TAccessPathNil(node.getDataFlowType()) ap = TAccessPathNil(node.getDataFlowType())
or or
@@ -3214,11 +3214,7 @@ module Impl<FullStateConfigSig Config> {
override predicate isSource() { override predicate isSource() {
sourceNode(node, state) and sourceNode(node, state) and
( sourceCallCtx(cc) and
if hasSourceCallCtx()
then cc instanceof CallContextSomeCall
else cc instanceof CallContextAny
) and
sc instanceof SummaryCtxNone and sc instanceof SummaryCtxNone and
ap = TAccessPathNil(node.getDataFlowType()) ap = TAccessPathNil(node.getDataFlowType())
} }