[PATCH] D107960: [clang][analyzer] Make ReturnPtrRange checker warn at negative index.

Balázs Kéri via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 12 06:29:53 PDT 2021


balazske created this revision.
Herald added subscribers: manas, steakhal, ASDenysPetrov, martong, gamesh411, dkrupp, donat.nagy, Szelethus, arphaman, mikhail.ramalho, a.sidorin, szepet, baloghadamsoftware, xazax.hun, whisperity.
Herald added a reviewer: Szelethus.
balazske requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

The checker did not work with negative array index at return.
Specially for -1 it did not produce a bug.
`assumeInBound` may not work correct with negative values so a pre-
check is added to the checker for negative array index.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D107960

Files:
  clang/lib/StaticAnalyzer/Checkers/ReturnPointerRangeChecker.cpp
  clang/test/Analysis/return-ptr-range.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D107960.365990.patch
Type: text/x-patch
Size: 6683 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210812/4bbcc42c/attachment.bin>


More information about the cfe-commits mailing list