It adds some comments about the ArrayBound and ArrayBoundV2. It would help the users deciding which to enable.
Further thoughts on this:
If V2 warns for all cases where V1 does, why do we let them enable both at the same time?
Differential D100829
[analyzer][docs] Highlight some differences between ArrayBound and V2 Authored by steakhal on Apr 20 2021, 1:55 AM.
Details
It adds some comments about the ArrayBound and ArrayBoundV2. It would help the users deciding which to enable. Further thoughts on this:
Diff Detail
Event Timeline
Comment Actions Add 'Limitations and bugs' section with a false-positive example.
| |||||||||||||||||||||||||||||
This doesn't seem to be true, MallocChecker's modeling and reporting parts are rather neatly separated, it should depend on unix.DinamicMemoryModeling. The warnings show even with the following command:
build/bin/clang -cc1 -analyze -analyzer-checker=core,alpha.security.ArrayBound,unix.Malloc test2.c
And should be patched, ideally:
diff --git a/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td b/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td index 444b00d73f0b..c36cfba2cdcf 100644 --- a/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td +++ b/clang/include/clang/StaticAnalyzer/Checkers/Checkers.td @@ -941,6 +941,7 @@ let ParentPackage = SecurityAlpha in { def ArrayBoundChecker : Checker<"ArrayBound">, HelpText<"Warn about buffer overflows (older checker)">, + Dependencies<[DynamicMemoryModeling]>, Documentation<HasAlphaDocumentation>; def ArrayBoundCheckerV2 : Checker<"ArrayBoundV2">,