Skip to content

Commit 0b082a4

Browse files
committed
C++: Only do argument check for
1 parent 20529b4 commit 0b082a4

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

cpp/ql/src/semmle/code/cpp/ir/dataflow/internal/DataFlowDispatch.qll

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,7 @@ Function viableCallable(CallInstruction call) {
2222
)
2323
or
2424
// Virtual dispatch
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-
)
25+
result = call.(VirtualDispatch::DataSensitiveCall).resolve()
3226
}
3327

3428
/**
@@ -141,6 +135,12 @@ private module VirtualDispatch {
141135
exists(FunctionInstruction fi |
142136
this.flowsFrom(DataFlow::instructionNode(fi), _) and
143137
result = fi.getFunctionSymbol()
138+
) and
139+
(
140+
this.getNumberOfArguments() <= result.getEffectiveNumberOfParameters() and
141+
this.getNumberOfArguments() >= result.getEffectiveNumberOfParameters()
142+
or
143+
result.isVarargs()
144144
)
145145
}
146146
}

0 commit comments

Comments
 (0)