[cfe-dev] [Analyzer] Tips on how to fix PR22954 ? (false positive memory leak warning)

Pierre Gousseau pierregousseau14 at gmail.com
Thu Jul 16 17:04:57 PDT 2015


Thanks, no worries I did not add them to Bcc, dont know what went wrong ...

Regards,

Pierre Gousseau
SN Systems - Sony Computer Entertainment

On 16 July 2015 at 15:24, Gábor Horváth <xazax.hun at gmail.com> wrote:

> On 16 July 2015 at 14:59, Pierre Gousseau <pierregousseau14 at gmail.com>
> wrote:
>
>> Ping !
>> Adding analyzer experts to cc.
>>
>
> Did you add them to bcc? I can not see them in CC. (So added them. Sorry
> in case it is redundant.)
>
>>
>> Regards,
>>
>> Pierre Gousseau
>> SN Systems - Sony Computer Entertainment
>>
>> On 2 July 2015 at 09:06, Pierre Gousseau <pierregousseau14 at gmail.com>
>> wrote:
>>
>>> Dear All,
>>>
>>> I have been looking into PR22954 which has been kindly raised by
>>> krzystof at https://llvm.org/bugs/show_bug.cgi?id=22954
>>> <https://urldefense.proofpoint.com/v2/url?u=https-3A__llvm.org_bugs_show-5Fbug.cgi-3Fid-3D22954&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=CnzuN65ENJ1H9py9XLiRvC_UQz6u3oG6GUNn7_wosSM&m=LxmcVZkm5xIjs1yr1VLtb4m0d77DEnuuKxA5OWJy0ik&s=20DofY-XUAVm4jp531KRZXRDke5d_wY6icOWPvtHJoA&e=>
>>> and being new to this area of Clang I would appreciate any tips on how to
>>> fix it.
>>>
>>> To me the root of the issue seems to originate from the CString checker
>>> as it performs invalidation of the destination buffer.
>>> Given the snippet below:
>>> -----------------
>>> struct aa { char *s; char data[32];};
>>> ...
>>> a.s = malloc(nbytes);
>>> memcpy(a.data, source, len);
>>> ...
>>> -----------------
>>> As the CString checker handles the memcpy call, it requests the
>>> invalidation of the 'a.data' region. But the invalidation worker seems to
>>> consider that the whole memory region of 'a' has to be invalidated. The
>>> Malloc checker is not made aware of this causing the false positive.
>>>
>>> It seems a short term fix could be to detect this specific case and have
>>> the CString checker notify the Malloc checker that it should stop tracking
>>> 'a.s'.
>>> However this solution would reduce the number of genuine defects
>>> detected.
>>>
>>> So I would be grateful if someone could give some hints on how to
>>> provide the right solution.
>>>
>>> Regards,
>>>
>>> Pierre Gousseau
>>> SN Systems - Sony Computer Entertainment
>>>
>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20150716/7edc6412/attachment.html>


More information about the cfe-dev mailing list