[clang] [analyzer] Add optin.taint.TaintedDiv checker (PR #106389)

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 30 04:57:52 PDT 2024


================
@@ -1703,6 +1703,12 @@ def TaintedAllocChecker: Checker<"TaintedAlloc">,
   Dependencies<[DynamicMemoryModeling, TaintPropagationChecker]>,
   Documentation<HasDocumentation>;
 
+def TaintedDivChecker: Checker<"TaintedDiv">,
+  HelpText<"Check for divisions, where the denominator "
+           "might be 0 as it is a tainted (attacker controlled) value.">,
----------------
NagyDonat wrote:

```suggestion
  HelpText<"Check for divisions where the denominator is tainted "
           "(attacker controlled) and might be 0.">,
```
Again, swapping the order clearly clarifies that taintedness is not covered by the "might". (Your wording was also understandable, but more complicated.)

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


More information about the cfe-commits mailing list