Fix double-delete crash in libclang/indexing.cpp
David Majnemer
david.majnemer at gmail.com
Thu Oct 24 08:26:59 PDT 2013
On Thu, Oct 24, 2013 at 8:10 AM, Olivier J. G. <olivier.jg at gmail.com> wrote:
> Ping?
>
The code review policy listed at
http://llvm.org/docs/DeveloperPolicy.html#code-reviews suggests waiting a
week before pinging.
>
>
> On Wed, Oct 23, 2013 at 6:09 PM, Olivier J. G. <olivier.jg at gmail.com>wrote:
>
>> Hi,
>>
>> While using clang_indexSourceFile(), I found that it crashes faithfully
>> when you give it unsaved files. Upon further inspection I found this is
>> apparently caused by a double-deletion:
>>
>> clang_indexSourceFile_Impl creates llvm::MemoryBuffers with the unsaved
>> file contents and uses MemBufferOwner to manage them.
>> However, it also creates an ASTUnit, which by default takes ownership of
>> the unsaved file buffers. This leads to double deletion of the unsaved file
>> buffers.
>>
>> While it's possible to use ASTUnit::setOwnsRemappedFileBuffers(false)
>> here, that would mean that the unsaved file contents are no longer
>> available to the out_TU, which is presumably incorrect.
>>
>> I've attached a (potential) fix.
>>
>> Cheers,
>>
>> -Olivier JG
>>
>
>
> _______________________________________________
> 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/20131024/11d2910d/attachment.html>
More information about the cfe-commits
mailing list