[all-commits] [llvm/llvm-project] 2e7dd4: [analyzer] Untangle subcheckers of CStringChecker ...
Endre Fülöp via All-commits
all-commits at lists.llvm.org
Wed Mar 25 02:58:16 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2e7dd442a562c12756d9a6a19479f628bc87d540
https://github.com/llvm/llvm-project/commit/2e7dd442a562c12756d9a6a19479f628bc87d540
Author: Endre Fülöp <endre.fulop at sigmatechnology.com>
Date: 2026-03-25 (Wed, 25 Mar 2026)
Changed paths:
M clang/lib/StaticAnalyzer/Checkers/CStringChecker.cpp
M clang/test/Analysis/bstring.cpp
M clang/test/Analysis/malloc.c
Log Message:
-----------
[analyzer] Untangle subcheckers of CStringChecker (#186802)
It turns out, that some checks for cstring functions happened as a side
effect of other checks. For example, whether the arguments to memcpy
were uninitialized happened during buffer overflow checking.
The way this was implemented is that if alpha.unix.cstring.OutOfBounds
was disabled, alpha.unix.cstring.UninitializedRead couldn't emit any
warnings. It turns out that major modeling steps are early-exited if a
certain checker is disabled!
This patch moved the early returns to the report emission parts --
modeling still happens, only the bug report construction is omitted.
This would mean that if we find a fatal error (like buffer overflow) we
_should_ stop analysis even if we don't emit a warning (thats a part of
doing modeling), but I decided against implementing that.
One hurdle is that CStringChecker is a dependency of MallocChecker, and
the current tests rely on the CStringChecker _not_ terminating execution
paths prematurely. Considering that the checkers that would do that are
in alpha anyways, this doesn't seem to be an urgent step immediately.
I added FIXMEs to all tests would have failed if the patch sank the
analysis at the fatal cstring function call, but didn't. I also added a
new test case for buffers overlapping, but not being quite equal.
Original Author: Kristóf Umann <dkszelethus at gmail.com>
Co-Author: Endre Fülöp <endre.fulop at sigmatechnology.com> (rebasing, cleaning up comments)
Reviewers added valuable suggestions to comments/test code organisation.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list