File tree Expand file tree Collapse file tree 1 file changed +12
-2
lines changed
cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal Expand file tree Collapse file tree 1 file changed +12
-2
lines changed Original file line number Diff line number Diff line change @@ -330,6 +330,12 @@ predicate mayBenefitFromCallContext(DataFlowPrivate::DataFlowCall call) {
330330 mayBenefitFromCallContext ( call , _, _)
331331}
332332
333+ private predicate localLambdaFlowStep ( Node nodeFrom , Node nodeTo ) {
334+ localFlowStep ( nodeFrom , nodeTo )
335+ or
336+ DataFlowPrivate:: additionalLambdaFlowStep ( nodeFrom , nodeTo , _)
337+ }
338+
333339/**
334340 * Holds if `call` is a call through a function pointer, and the pointer
335341 * value is given as the `arg`'th argument to `f`.
@@ -339,9 +345,13 @@ private predicate mayBenefitFromCallContext(
339345) {
340346 f = pragma [ only_bind_out ] ( call ) .getEnclosingCallable ( ) and
341347 exists ( InitializeParameterInstruction init |
342- not exists ( call .getStaticCallTarget ( ) ) and
348+ not exists ( call .getStaticCallTarget ( ) )
349+ or
350+ exists ( call .getStaticCallSourceTarget ( ) .( VirtualFunction ) .getAnOverridingFunction ( ) )
351+ |
343352 init .getEnclosingFunction ( ) = f .getUnderlyingCallable ( ) and
344- call .flowsFrom ( instructionNode ( init ) , _) and
353+ localLambdaFlowStep + ( instructionNode ( init ) ,
354+ operandNode ( call .asCallInstruction ( ) .getCallTargetOperand ( ) ) ) and
345355 init .getParameter ( ) .getIndex ( ) = arg
346356 )
347357}
You can’t perform that action at this time.
0 commit comments