[PATCH] D150446: [analyzer] Check ArraySubscriptExprs in ArrayBoundCheckerV2

DonĂ¡t Nagy via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri May 12 06:44:14 PDT 2023


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

The checker alpha.security.ArrayBoundV2 was implemented with a `check::Location` callback, so it triggered on memory read or write operations (and checked access to ElementRegions).

The generality of this solution was elegant, but I'm replacing it with an implementation based on `check::PreStmt<ArraySubscriptExpr>`, because that's closer to the intuition of the users. (I'm planning to improve the error messages and it'd be good to connect each bug report with a concrete operator that triggers it.)

Note that the logic for simplifying expressions is unchanged and this commit doesn't modify the behavior of the checker under common circumstances (e.g. all unit tests pass without changes).


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D150446

Files:
  clang/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D150446.521634.patch
Type: text/x-patch
Size: 10569 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230512/b60ff6a4/attachment-0001.bin>


More information about the cfe-commits mailing list