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 @@ -328,6 +328,12 @@ predicate mayBenefitFromCallContext(DataFlowPrivate::DataFlowCall call) {
328328 mayBenefitFromCallContext ( call , _, _)
329329}
330330
331+ private predicate localLambdaFlowStep ( Node nodeFrom , Node nodeTo ) {
332+ localFlowStep ( nodeFrom , nodeTo )
333+ or
334+ DataFlowPrivate:: additionalLambdaFlowStep ( nodeFrom , nodeTo , _)
335+ }
336+
331337/**
332338 * Holds if `call` is a call through a function pointer, and the pointer
333339 * value is given as the `arg`'th argument to `f`.
@@ -337,9 +343,13 @@ private predicate mayBenefitFromCallContext(
337343) {
338344 f = pragma [ only_bind_out ] ( call ) .getEnclosingCallable ( ) and
339345 exists ( InitializeParameterInstruction init |
340- not exists ( call .getStaticCallTarget ( ) ) and
346+ not exists ( call .getStaticCallTarget ( ) )
347+ or
348+ exists ( call .getStaticCallSourceTarget ( ) .( VirtualFunction ) .getAnOverridingFunction ( ) )
349+ |
341350 init .getEnclosingFunction ( ) = f .getUnderlyingCallable ( ) and
342- call .flowsFrom ( instructionNode ( init ) , _) and
351+ localLambdaFlowStep + ( instructionNode ( init ) ,
352+ operandNode ( call .asCallInstruction ( ) .getCallTargetOperand ( ) ) ) and
343353 init .getParameter ( ) .getIndex ( ) = arg
344354 )
345355}
You can’t perform that action at this time.
0 commit comments