[PATCH] D92764: [analyzer][StdLibraryFunctionsChecker] Make close and mmap to accept -1 as fd
Gabor Marton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 7 08:41:02 PST 2020
martong updated this revision to Diff 309931.
martong marked an inline comment as done.
martong added a comment.
- Use -1 for mmap too
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92764/new/
https://reviews.llvm.org/D92764
Files:
clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
Index: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
===================================================================
--- clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
+++ clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp
@@ -1672,7 +1672,7 @@
addToFunctionSummaryMap("close", Signature(ArgTypes{IntTy}, RetType{IntTy}),
Summary(NoEvalCall)
.ArgConstraint(ArgumentCondition(
- 0, WithinRange, Range(0, IntMax))));
+ 0, WithinRange, Range(-1, IntMax))));
// long fpathconf(int fildes, int name);
addToFunctionSummaryMap("fpathconf",
@@ -1734,7 +1734,7 @@
Summary(NoEvalCall)
.ArgConstraint(ArgumentCondition(1, WithinRange, Range(1, SizeMax)))
.ArgConstraint(
- ArgumentCondition(4, WithinRange, Range(0, IntMax))));
+ ArgumentCondition(4, WithinRange, Range(-1, IntMax))));
Optional<QualType> Off64_tTy = lookupTy("off64_t");
// void *mmap64(void *addr, size_t length, int prot, int flags, int fd,
@@ -1746,7 +1746,7 @@
Summary(NoEvalCall)
.ArgConstraint(ArgumentCondition(1, WithinRange, Range(1, SizeMax)))
.ArgConstraint(
- ArgumentCondition(4, WithinRange, Range(0, IntMax))));
+ ArgumentCondition(4, WithinRange, Range(-1, IntMax))));
// int pipe(int fildes[2]);
addToFunctionSummaryMap(
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92764.309931.patch
Type: text/x-patch
Size: 1552 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201207/b582e0a9/attachment.bin>
More information about the cfe-commits
mailing list