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

Balázs Benics via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 2 07:41:56 PST 2020


steakhal accepted this revision.
steakhal added a comment.
This revision is now accepted and ready to land.

Awesome, thank you.



================
Comment at: clang/lib/StaticAnalyzer/Checkers/StdLibraryFunctionsChecker.cpp:1771
+            .Case({ReturnValueCondition(LessThanOrEq, ArgNo(2)),
+                   ReturnValueCondition(WithinRange, Range(-1, Ssize_tMax))})
             .ArgConstraint(NotNull(ArgNo(0)))
----------------
martong wrote:
> 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.
I overlooked that we have a single `Case`, my bad.


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