File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
cpp/ql/src/semmle/code/cpp/ir
implementation/aliased_ssa Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,13 @@ Function viableCallable(CallInstruction call) {
2222 )
2323 or
2424 // Virtual dispatch
25- result = call .( VirtualDispatch:: DataSensitiveCall ) .resolve ( )
25+ result = call .( VirtualDispatch:: DataSensitiveCall ) .resolve ( ) and
26+ (
27+ call .getNumberOfArguments ( ) <= result .getEffectiveNumberOfParameters ( ) and
28+ call .getNumberOfArguments ( ) >= result .getEffectiveNumberOfParameters ( )
29+ or
30+ result .isVarargs ( )
31+ )
2632}
2733
2834/**
Original file line number Diff line number Diff line change @@ -1202,6 +1202,11 @@ class CallInstruction extends Instruction {
12021202 final Instruction getPositionalArgument ( int index ) {
12031203 result = getPositionalArgumentOperand ( index ) .getDef ( )
12041204 }
1205+
1206+ /**
1207+ * Gets the number of arguments of the call, including the `this` pointer, if any.
1208+ */
1209+ final int getNumberOfArguments ( ) { result = count ( this .getAnArgumentOperand ( ) ) }
12051210}
12061211
12071212/**
You can’t perform that action at this time.
0 commit comments