[clang] [analyzer] Improve handling of unsigned values in ArrayBoundCheckerV2 (PR #81034)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 9 08:40:36 PDT 2024


NagyDonat wrote:

These reports are definitely FPs caused by buggy number handling, so it would be good to suppress them.

I was planning to rewrite both `alpha.security.ReturnPtrRange` and `alpha.unix.cstring.OutOfBounds` to rely on the "backend" prototyped within ArrayBoundV2 instead of the current logic (which is AFAIK equivalent to ArrayBound V1). In fact, `alpha.security.ReturnPtrRange` is so close to array bounds checking, that probably it would be good to implement it as a subchecker within the `ArrayBoundCheckerV2` checker class (which can be enabled/disabled independently, but uses the same infrastructure). 

However, I was planning to do these improvements after bringing `ArrayBoundV2` out of the alpha state, and unfortunately that's severely delayed because I'm bogged down with the loop handling improvements.

If you want to suppress these reports, it would be very nice if you could do it by refactoring these checkers to reuse the bounds checking logic that's defined within ArrayBoundsV2. You could also tweak the current implementation of these checkers, but I'll probably throw away those changes when I'll (hopefully) switch to using the logic of ArrayBoundV2.

https://github.com/llvm/llvm-project/pull/81034


More information about the cfe-commits mailing list