[clang] [analyzer] Untangle subcheckers of CStringChecker (PR #113312)

via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 22 20:04:22 PDT 2024


================
@@ -614,10 +620,6 @@ CStringChecker::CheckBufferAccess(CheckerContext &C, ProgramStateRef State,
   if (!State)
     return nullptr;
 
-  // If out-of-bounds checking is turned off, skip the rest.
-  if (!Filter.CheckCStringOutOfBounds)
-    return State;
-
----------------
isuckatcs wrote:

Doesn't removing this check here mean that the user will see certain bugs reported even if this option is turned off?

This check prevents `CheckLocation()` and `checkInit()` from being called. The former is a not a problem, as it only emits warnings if `Filter.CheckCStringBufferOverlap` is enabled, but the latter only checks `Filter.CheckCStringUninitializedRead`.

I suspect that we might see some warnings, we haven't seen before if `Filter.CheckCStringOutOfBounds` is disabled and `Filter.CheckCStringUninitializedRead` is enabled. Can you please add a testcase for this?

https://github.com/llvm/llvm-project/pull/113312


More information about the cfe-commits mailing list