[PATCH] D92474: [analyzer][StdLibraryFunctionsChecker] Add return value constraint to functions with BufferSize

Gabor Marton via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 2 06:36:42 PST 2020


martong marked 3 inline comments as done.
martong added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:1771
+            .Case({ReturnValueCondition(LessThanOrEq, ArgNo(2)),
+                   ReturnValueCondition(WithinRange, Range(-1, Ssize_tMax))})
             .ArgConstraint(NotNull(ArgNo(0)))
----------------
steakhal wrote:
> 
The two constraints are applied in the same case (branch), the second is more generic. The first constraint may not have any effect if Arg2 is Unknown. Consequently, [-1, -1] would be too strict in such cases.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D92474/new/

https://reviews.llvm.org/D92474



More information about the cfe-commits mailing list