[clang] [analyzer] Fix nullptr dereference for symbols from pointer invalidation (PR #106568)

via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 29 08:20:35 PDT 2024


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 8ae877a089d9c2ca5315d3b2e0144c4d9f82cf5c 71aae8d0cc96d389da95c2231b1145b7ffeb2132 --extensions c,cpp -- clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp clang/test/Analysis/stack-addr-ps.c
``````````

</details>

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

``````````diff
diff --git a/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp b/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
index d3b1855417..ec577c3618 100644
--- a/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
+++ b/clang/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp
@@ -308,7 +308,7 @@ static const MemSpaceRegion *getStackOrGlobalSpaceRegion(const MemRegion *R) {
 const MemRegion *getOriginBaseRegion(const MemRegion *Reg) {
   Reg = Reg->getBaseRegion();
   while (const auto *SymReg = dyn_cast<SymbolicRegion>(Reg)) {
-    const auto* OriginReg = SymReg->getSymbol()->getOriginRegion();
+    const auto *OriginReg = SymReg->getSymbol()->getOriginRegion();
     if (!OriginReg)
       break;
     Reg = OriginReg->getBaseRegion();

``````````

</details>


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


More information about the cfe-commits mailing list