[PATCH] D84248: [analyzer][StdLibraryFunctionsChecker] Add POSIX time handling functions
Gabor Marton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 13 02:16:14 PDT 2020
martong added inline comments.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:2040
+
+ if (ConstStructTimevalPtrTy && StructTimespecPtrTy)
+ // int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
----------------
balazske wrote:
> Should be `ConstStructTimespecPtrTy`.
Thanks!
================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:2092
+ .ArgConstraint(NotNull(ArgNo(0)))
+ .ArgConstraint(NotNull(ArgNo(1))));
+
----------------
balazske wrote:
> Is it possible to check for the size of the passed buffer? The man page says that `buf` should have room for 26 bytes (for `ctime_r` too).
Yes, absolutely, this is a very good observation. I extended the BufferSize constraint to handle concrete values as well.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84248/new/
https://reviews.llvm.org/D84248
More information about the cfe-commits
mailing list