зеркало из https://github.com/github/codeql.git
C++: should only match those functions that has the same number of parameters as the call has arguments.
This commit is contained in:
Родитель
228bd73bd2
Коммит
14d836ba59
|
@ -22,7 +22,13 @@ Function viableCallable(CallInstruction call) {
|
|||
)
|
||||
or
|
||||
// Virtual dispatch
|
||||
result = call.(VirtualDispatch::DataSensitiveCall).resolve()
|
||||
result = call.(VirtualDispatch::DataSensitiveCall).resolve() and
|
||||
(
|
||||
call.getNumberOfArguments() <= result.getEffectiveNumberOfParameters() and
|
||||
call.getNumberOfArguments() >= result.getEffectiveNumberOfParameters()
|
||||
or
|
||||
result.isVarargs()
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1202,6 +1202,11 @@ class CallInstruction extends Instruction {
|
|||
final Instruction getPositionalArgument(int index) {
|
||||
result = getPositionalArgumentOperand(index).getDef()
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the number of arguments of the call, including the `this` pointer, if any.
|
||||
*/
|
||||
final int getNumberOfArguments() { result = count(this.getAnArgumentOperand()) }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче