[PATCH] Fix memory corruption in CStringChecker
Manuel Klimek
klimek at google.com
Tue Jun 11 01:36:09 PDT 2013
+Argyrios
On Tue, Jun 11, 2013 at 10: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)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130611/9e7ff033/attachment.html>
More information about the cfe-commits
mailing list