Skip to content

Commit a0cfe82

Browse files
committed
[CPP-340] Replace whitelist with f.getBlock() test. Fix doc comment.
1 parent 4a760b1 commit a0cfe82

File tree

2 files changed

+4
-16
lines changed

2 files changed

+4
-16
lines changed

cpp/ql/src/Likely Bugs/Underspecified Functions/MistypedFunctionArguments.ql

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
/**
22
* @name Call to a function with one or more incompatible arguments
3-
* @description A call to a function with at least one argument whose type does
4-
* not match the type of the corresponding function parameter. This may indicate
5-
* that the author is not familiar with the function being called. Passing mistyped
6-
* arguments on a stack may lead to unpredictable function behavior.
3+
* @description When the type of a function argument is not compatible
4+
* with the type of the corresponding parameter, it may lead to
5+
* unpredictable behavior.
76
* @kind problem
87
* @problem.severity warning
98
* @precision medium

cpp/ql/src/Likely Bugs/Underspecified Functions/TooManyArguments.ql

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,13 @@ predicate isCompiledAsC(Function f) {
3131
)
3232
}
3333

34-
predicate isWhitelisted(Function f) {
35-
f instanceof BuiltInFunction
36-
or
37-
// The following list can be expanded as the need arises
38-
exists(string name | name = f.getName() |
39-
name = "static_assert" or
40-
name = "_Static_assert" or
41-
name = "strptime"
42-
)
43-
}
44-
4534
from FunctionCall fc, Function f
4635
where
4736
f = fc.getTarget() and
4837
not f.isVarargs() and
4938
hasZeroParamDecl(f) and
5039
isCompiledAsC(f) and
51-
not isWhitelisted(f) and
40+
exists(f.getBlock()) and
5241
// There must not exist a declaration with the number of parameters
5342
// at least as large as the number of call arguments
5443
not exists(FunctionDeclarationEntry fde | fde = f.getADeclarationEntry() |

0 commit comments

Comments
 (0)