[clang] [StaticAnalyzer][MallocChecker] Detect use-after-free for field address (e.g., &ptr->field) (PR #152462)

via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 7 06:43:42 PDT 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff HEAD~1 HEAD --extensions c,cpp -- clang/test/Analysis/malloc-checker-arg-uaf.c clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
index ad1d20779..8488c53c6 100644
--- a/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp
@@ -3163,7 +3163,7 @@ void MallocChecker::checkPreCall(const CallEvent &Call,
       SymbolRef Sym = nullptr;
       if (const auto *SR = dyn_cast<SymbolicRegion>(BaseRegion))
         Sym = SR->getSymbol();
-      if (!Sym) 
+      if (!Sym)
         continue;
       if (checkUseAfterFree(Sym, C, Call.getArgExpr(I)))
         return;

``````````

</details>


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


More information about the cfe-commits mailing list