[PATCH] D154838: [analyzer] Add check for null pointer passed to %p of printf family

2023-08-29 Thread Georgiy Lebedev via Phabricator via cfe-commits
CuriousGeorgiy updated this revision to Diff 554259. CuriousGeorgiy marked 2 inline comments as done. CuriousGeorgiy added a comment. Herald added a subscriber: ormris. [analyzer] Add check for null pointer passed to the %p of printf family The result of passing a null pointer to the pointer conv

[PATCH] D154838: [analyzer] Add check for null pointer passed to %p of printf family

2023-08-10 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. Looks pretty good. Comment at: clang/docs/analyzer/checkers.rst:704 +optin.portabilityMinor.UnixAPI +" +Finds non-severe implementation-defined behavior in UNIX/Posix functions. This line should be just as long,

[PATCH] D154838: [analyzer] Add check for null pointer passed to %p of printf family

2023-08-10 Thread Georgiy Lebedev via Phabricator via cfe-commits
CuriousGeorgiy added a comment. @NoQ thank you for the feedback too! > So if you want to support non-standard functions, and you know that they have > the same portability issues, totally go for it! AFAIC, the functions I listed are very exotic, so I would rather skip them. > Probably a separa

[PATCH] D154838: [analyzer] Add check for null pointer passed to %p of printf family

2023-08-10 Thread Georgiy Lebedev via Phabricator via cfe-commits
CuriousGeorgiy added a comment. @MitalAshok > Instead of checking for hard-coded names, you can check functions with the > format(printf, x, y) attribute @NoQ pointed out this is too generic, and we should go for a case-by-case approach. > You also have to check for pointer types first. This

[PATCH] D154838: [analyzer] Add check for null pointer passed to %p of printf family

2023-07-25 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ added a comment. > Should I cover non-standard (i.e., non ISO C standard) functions from the > `printf_s` family? Should I cover non-standard functions like `dprintf`? The static analyzer, unlike the compiler proper, isn't required to treat all code fairly. It's ok to have different behavio

[PATCH] D154838: [analyzer] Add check for null pointer passed to %p of printf family

2023-07-25 Thread Mital Ashok via Phabricator via cfe-commits
MitalAshok added a comment. Instead of checking for hard-coded names, you can check functions with the format(printf, x, y) attribute: if (auto *Format = FD->getAttr()) CheckPrintfPointerConversionSpecifierNULL(C, CE, Format->ge

[PATCH] D154838: [analyzer] Add check for null pointer passed to %p of printf family

2023-07-16 Thread Balázs Benics via Phabricator via cfe-commits
steakhal added a comment. Expect a review on around the next weekend due to vacations from me. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D154838/new/ https://reviews.llvm.org/D154838 ___ cfe-commits m

[PATCH] D154838: [analyzer] Add check for null pointer passed to %p of printf family

2023-07-10 Thread Georgiy Lebedev via Phabricator via cfe-commits
CuriousGeorgiy added a comment. Hi! This is my first time contributing to the LLVM project and particularly the clang static analyzer. This patch is based off https://reviews.llvm.org/D139604?id=481154. I have several questions regarding the reviewers comments (most of which I tried to address)