4 Commits

Author SHA1 Message Date
Balázs Kéri
4dfa0216ba
[clang][analyzer] Bring checker 'alpha.unix.cstring.NotNullTerminated' out of alpha (#113899) 2024-11-27 09:41:12 +01:00
Balázs Kéri
9df8d8d05c
[clang][analyzer] Improve test and documentation in cstring NotNullTerminated checker (#112019)
CStringChecker has a sub-checker alpha.unix.cstring.NotNullTerminated
which checks for invalid objects passed to string functions. The checker
and its name are not exact and more functions could be checked, this
change only adds some tests and improves documentation.
2024-10-16 10:17:34 +02:00
Balazs Benics
a49cf6c14a [analyzer] Fix "sprintf" parameter modeling in CStringChecker
`CE->getCalleeDecl()` returns `VarDecl` if the callee is actually a
function pointer variable. Consequently, calling `getAsFunction()` will
return null.

To workaround the case, we should use the `CallEvent::parameters()`,
which will internally recover the function being called and do the right
thing.

Fixes #74269
Depends on "[analyzer][NFC] Prefer CallEvent over CallExpr in APIs"
2023-12-28 16:06:21 +01:00
Artem Dergachev
a749d602b5 [analyzer] CStringChecker: Add the forgotten test file.
Differential Revision: https://reviews.llvm.org/D55873

rdar://problem/45366551

llvm-svn: 349683
2018-12-19 21:51:59 +00:00