[PATCH] Fix memory corruption in CStringChecker
Argyrios Kyrtzidis
akyrtzi at gmail.com
Tue Jun 11 09:49:33 PDT 2013
+ Anna.
On Jun 11, 2013, at 1:30 AM, Pavel Labath <labath at google.com> wrote:
> Hi klimek,
>
> "register" functions for the checker were caching the checker objects in a
> static variable. This caused problems when the function is called with a
> different CheckerManager.
>
> http://llvm-reviews.chandlerc.com/D955
>
> Files:
> lib/StaticAnalyzer/Checkers/CStringChecker.cpp
>
> Index: lib/StaticAnalyzer/Checkers/CStringChecker.cpp
> ===================================================================
> --- lib/StaticAnalyzer/Checkers/CStringChecker.cpp
> +++ lib/StaticAnalyzer/Checkers/CStringChecker.cpp
> @@ -2018,10 +2018,7 @@
>
> #define REGISTER_CHECKER(name) \
> void ento::register##name(CheckerManager &mgr) {\
> - static CStringChecker *TheChecker = 0; \
> - if (TheChecker == 0) \
> - TheChecker = mgr.registerChecker<CStringChecker>(); \
> - TheChecker->Filter.Check##name = true; \
> + mgr.registerChecker<CStringChecker>()->Filter.Check##name = true; \
> }
>
> REGISTER_CHECKER(CStringNullArg)
> <Mail Attachment>_______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130611/b8e94fa3/attachment.html>
More information about the cfe-commits
mailing list