[clang] [StaticAnalyzer][MallocChecker] Detect use-after-free for field address (e.g., &ptr->field) (PR #152462)
Balazs Benics via cfe-commits
cfe-commits at lists.llvm.org
Fri Aug 8 10:21:18 PDT 2025
================
@@ -3156,8 +3156,8 @@ void MallocChecker::checkPreCall(const CallEvent &Call,
for (unsigned I = 0, E = Call.getNumArgs(); I != E; ++I) {
SVal ArgSVal = Call.getArgSVal(I);
if (isa<Loc>(ArgSVal)) {
- SymbolRef Sym = ArgSVal.getAsSymbol();
- if (!Sym)
+ SymbolRef Sym = ArgSVal.getAsSymbol(/*IncludeBaseRegions=*/true);
+ if (!Sym)
----------------
steakhal wrote:
```suggestion
if (!Sym)
```
https://github.com/llvm/llvm-project/pull/152462
More information about the cfe-commits
mailing list