[clang] [WIP] [analyzer] Refactor MallocChecker to use `BindExpr` in `evalCall` (PR #106081)

Pavel Skripkin via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 28 02:17:49 PDT 2024


================
@@ -2815,7 +2906,7 @@ MallocChecker::ReallocMemAux(CheckerContext &C, const CallEvent &Call,
 
     // Get the from and to pointer symbols as in toPtr = realloc(fromPtr, size).
     SymbolRef FromPtr = arg0Val.getLocSymbolInBase();
-    SVal RetVal = C.getSVal(CE);
+    SVal RetVal = stateRealloc->getSVal(CE, C.getLocationContext());
     SymbolRef ToPtr = RetVal.getAsSymbol();
     assert(FromPtr && ToPtr &&
            "By this point, FreeMemAux and MallocMemAux should have checked "
----------------
pskrgag wrote:

Based on code inspection and basic tests (like passing undefined values to realloc) this assertation still holds

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


More information about the cfe-commits mailing list