The checker recognizes handlers assigned to members of a
"struct sigaction" variable. If a function is assigned to
these members it is assumable that the function is used as signal handler
(function 'sigaction' is called with it).
Without this simplification the check is possible only in path-sensitive way.
Details
Details
- Reviewers
alexfh hokein aaron.ballman njames93
Diff Detail
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
clang-tools-extra/clang-tidy/cert/SignalHandlerCheck.cpp | ||
---|---|---|
91 | You should be checking for the fully-qualified name so that this doesn't trip it up: namespace awesome { struct sigaction { const char *terrible = "haha"; }; } | |
92 | I'd like to see a test case that this works properly with references in C++ (in addition to pointers). | |
clang-tools-extra/test/clang-tidy/checkers/cert-sig30-c.cpp | ||
152 | I'd like to see a test case that shows this works if the sigaction object is within another structure. e.g., struct foo { struct sigaction act; }; void test(void) { struct foo f; f.act.sa_handler = handler_sigaction5; } |
You should be checking for the fully-qualified name so that this doesn't trip it up: