[PATCH] D47135: [analyzer] A checker for dangling internal buffer pointers in C++

Gábor Horváth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat May 26 11:32:12 PDT 2018


xazax.hun added inline comments.


================
Comment at: lib/StaticAnalyzer/Checkers/DanglingInternalBufferChecker.cpp:65
+  if (Call.isCalled(CStrFn)) {
+    SymbolRef RawPtr = Call.getReturnValue().getAsSymbol();
+    State = State->set<RawPtrMap>(TypedR, RawPtr);
----------------
xazax.hun wrote:
> I wonder if we can always get a symbol.
> I can think of two cases when the call above could fail:
> * Non-standard implementation that does not return a pointer
> * The analyzer able to inline stuff and the returned value is a constant (a specific address that is shared between all empty strings in some implementation?)
> 
> Even though I do find any of the above likely. @NoQ what do you think? Does this worth a check?
Sorry for the spam. Unfortunately, it is not possible to edit the comments.
I do *not* find any of the above likely.


https://reviews.llvm.org/D47135





More information about the cfe-commits mailing list