зеркало из https://github.com/github/codeql.git
CPP: Add exception for builtins.
This commit is contained in:
Родитель
7a877bfe14
Коммит
4f002291c5
|
@ -11,25 +11,31 @@
|
|||
|
||||
import cpp
|
||||
|
||||
predicate whitelist(string fName) {
|
||||
fName = "ceil" or
|
||||
fName = "ceilf" or
|
||||
fName = "ceill" or
|
||||
fName = "floor" or
|
||||
fName = "floorf" or
|
||||
fName = "floorl" or
|
||||
fName = "nearbyint" or
|
||||
fName = "nearbyintf" or
|
||||
fName = "nearbyintl" or
|
||||
fName = "rint" or
|
||||
fName = "rintf" or
|
||||
fName = "rintl" or
|
||||
fName = "round" or
|
||||
fName = "roundf" or
|
||||
fName = "roundl" or
|
||||
fName = "trunc" or
|
||||
fName = "truncf" or
|
||||
fName = "truncl"
|
||||
predicate whitelist(Function f) {
|
||||
exists(string fName |
|
||||
fName = f.getName() and
|
||||
(
|
||||
fName = "ceil" or
|
||||
fName = "ceilf" or
|
||||
fName = "ceill" or
|
||||
fName = "floor" or
|
||||
fName = "floorf" or
|
||||
fName = "floorl" or
|
||||
fName = "nearbyint" or
|
||||
fName = "nearbyintf" or
|
||||
fName = "nearbyintl" or
|
||||
fName = "rint" or
|
||||
fName = "rintf" or
|
||||
fName = "rintl" or
|
||||
fName = "round" or
|
||||
fName = "roundf" or
|
||||
fName = "roundl" or
|
||||
fName = "trunc" or
|
||||
fName = "truncf" or
|
||||
fName = "truncl" or
|
||||
fName.matches("__builtin_%")
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
predicate whitelistPow(FunctionCall fc) {
|
||||
|
@ -44,7 +50,7 @@ predicate whitelistPow(FunctionCall fc) {
|
|||
}
|
||||
|
||||
predicate whiteListWrapped(FunctionCall fc) {
|
||||
whitelist(fc.getTarget().getName()) or
|
||||
whitelist(fc.getTarget()) or
|
||||
whitelistPow(fc) or
|
||||
exists(ReturnStmt rs |
|
||||
rs.getEnclosingFunction() = fc.getTarget() and
|
||||
|
|
Загрузка…
Ссылка в новой задаче