[PATCH] Fix memory corruption in CStringChecker

Anna Zaks ganna at apple.com
Tue Jun 11 22:40:37 PDT 2013


Looks good. Please commit.

Thanks for fixing,
Anna.
On Jun 11, 2013, at 9:49 AM, Argyrios Kyrtzidis <akyrtzi at gmail.com> wrote:

> + 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/29e1d4a0/attachment.html>


More information about the cfe-commits mailing list