@@ -3459,6 +3459,16 @@ private class PathNodeMid extends PathNodeImpl, TPathNodeMid {
34593459 ap instanceof AccessPathNil and
34603460 if hasSinkCallCtx ( config )
34613461 then
3462+ // For `FeatureHasSinkCallContext` the condition `cc instanceof CallContextNoCall`
3463+ // is exactly what we need to check. This also implies
3464+ // `sc instanceof SummaryCtxNone`.
3465+ // For `FeatureEqualSourceSinkCallContext` the initial call context was
3466+ // set to `CallContextSomeCall` and jumps are disallowed, so
3467+ // `cc instanceof CallContextNoCall` never holds. On the other hand,
3468+ // in this case there's never any need to enter a call except to identify
3469+ // a summary, so the condition in `pathIntoCallable` enforces this, which
3470+ // means that `sc instanceof SummaryCtxNone` holds if and only if we are
3471+ // in the call context of the source.
34623472 sc instanceof SummaryCtxNone or
34633473 cc instanceof CallContextNoCall
34643474 else any ( )
@@ -3664,6 +3674,9 @@ private predicate pathIntoCallable(
36643674 or
36653675 not exists ( TSummaryCtxSome ( p , ap ) ) and
36663676 sc = TSummaryCtxNone ( ) and
3677+ // When the call contexts of source and sink needs to match then there's
3678+ // never any reason to enter a callable except to find a summary. See also
3679+ // the comment in `PathNodeMid::isAtSink`.
36673680 not config .getAFeature ( ) instanceof FeatureEqualSourceSinkCallContext
36683681 )
36693682 |
0 commit comments