[PATCH] D64680: [analyzer] MallocChecker: Prevent Integer Set Library false positives

Csaba Dabis via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 17 16:42:28 PDT 2019


Charusso added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/MallocChecker.cpp:2549-2552
+      FunctionStr = Lexer::getSourceText(
+          CharSourceRange::getTokenRange(
+              {FD->getBeginLoc(), FD->getBody()->getBeginLoc()}),
+          C.getSourceManager(), C.getLangOpts());
----------------
NoQ wrote:
> Charusso wrote:
> > NoQ wrote:
> > > I'm slightly worried that it'll crash when `free()` is being called from within a body farm.
> > > 
> > > For now it probably cannot happen because none of the bodyfarmed functions can call `free()` directly, but i'd anyway rather add a check that the source locations we're taking are valid.
> > Oh, I missed that, thanks! I wanted to check for everything, yes.
> I think this is not fixed yet. I'm thinking of something like `if (!Body->getBeginLoc().isValid()) { ... }`.
Ugh, silly mistake, thanks!


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64680/new/

https://reviews.llvm.org/D64680





More information about the cfe-commits mailing list