Previously by following the documentation it was not immediately clear what the capabilities of this checker are.
In this patch, I add some clarification on when does the checker issue a report and what it's limitations are.
I'm also advertising suppressing such reports by adding an assertion, as demonstrated by the test3().
I'm highlighting that this checker might produce an extensive amount of findings, but it might be still useful for code audits.
IMO the rule this checker enforces seems to be solid and complete by considering the capabilities of an AST-based approach.
Quoting @NoQ from cfe-dev: Alpha checker statuses. @ Tue May 14 15:40:33 PDT 2019:
alpha.security.MallocOverflow:
This one's extremely loud for me (~1500 false positives). It looks as if it warns on every malloc(x * sizeof(int)) (due to potential integer overflow during multiplication) so i just don't see it working as an AST-based check. We should probably rewrite it on top of taint analysis and then it'll need a constraint solver that knows how to multiply things.
It suggests to me that this checker is supposed to be replaced by a path-sensitive implementation and remove this AST-based one from the source tree.
However, I think this checker has its value, even if its scope is a narrower user-base.
That being said, AFAIK the optin package houses the checkers which are ready for production but enforces a specific coding style or rule, although not recommended for default use. Shouldn't we move this checker to the optin package instead?
If not, we should probably pinpoint the requirements to do so and document them as TODOs in a subsequent patch.
WDYT?
Am I supposed to indent this with 2 spaces? Or what.