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

DonĂ¡t Nagy via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 29 03:15:23 PDT 2024


================
@@ -58,8 +68,15 @@ void DivZeroChecker::reportBug(StringRef Msg, ProgramStateRef StateZero,
 void DivZeroChecker::reportTaintBug(
     StringRef Msg, ProgramStateRef StateZero, CheckerContext &C,
     llvm::ArrayRef<SymbolRef> TaintedSyms) const {
+  if (!ChecksEnabled[CK_TaintedDivChecker])
+    return;
+  if (!BugTypes[CK_TaintedDivChecker])
+    BugTypes[CK_TaintedDivChecker].reset(
+        new BugType(CheckNames[CK_TaintedDivChecker], "Division by zero",
+                    categories::TaintedData));
   if (ExplodedNode *N = C.generateErrorNode(StateZero)) {
----------------
NagyDonat wrote:

Consider using a  non-fatal error node here and in other taint bugs. (Perhaps in a follow-up commit?)

When the analyzer finds a taint bug, it only says that "this _may_ cause a problem" so it's relevant to know that later something is _definitely_ problematic. 

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


More information about the cfe-commits mailing list