<div dir="ltr">Change LGTM. It'd be nice to have test coverage for this that doesn't require running a sanitizer. Do we have any direct tests for ASTVector?</div><div class="gmail_extra"><br><br><div class="gmail_quote">
On Mon, Nov 18, 2013 at 9:35 PM, Will Dietz <span dir="ltr"><<a href="mailto:wdietz2@illinois.edu" target="_blank">wdietz2@illinois.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Ping! :)<br>
<span class="HOEnZb"><font color="#888888"><br>
~Will<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
On Mon, Nov 4, 2013 at 4:32 PM, Will Dietz <<a href="mailto:wdietz2@illinois.edu">wdietz2@illinois.edu</a>> wrote:<br>
> Ping.<br>
><br>
> It's easy to get clang to trigger this bug which results in an invalid<br>
> iterator to be returned (which the current code happens to ignore, but<br>
> that's just a lucky coincidence), as this regularly occurs during<br>
> execution of the lit tests.<br>
><br>
> On a related note, any suggestions on how to create a simple dummy<br>
> ASTContext for testing? As noted in<br>
> the commit that originally added ASTVectorTest.cpp (r186253) this<br>
> blocks the creation of even basic<br>
> functionality tests for this data structure.<br>
><br>
> ~Will<br>
><br>
> On Mon, Oct 28, 2013 at 5:11 PM, Will Dietz <<a href="mailto:wdietz2@illinois.edu">wdietz2@illinois.edu</a>> wrote:<br>
>> Error caught -fsanitize=pointer-overflow[1], curiously enough :).<br>
>><br>
>> The pointer overflow occurred when insert() was invoked with From==To,<br>
>> which is done in quite a few places.  While std::vector::insert<br>
>> requires [From,To) to be valid, it looks like here From==To is<br>
>> intended to be supported[2], making the bug in the container not in<br>
>> its use.<br>
>><br>
>> This patch fixes the overflow when From==To, as well as the return<br>
>> value in this variant as well as the "fill" variant, changing them to<br>
>> return an iterator pointing to the first of the inserted elements<br>
>> (like SmallVector does).<br>
>><br>
>> See attached.<br>
>><br>
>> ~Will<br>
>><br>
>> [1] Patches coming soon.<br>
>> [2] See the implementation of append(), for example.<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</div></div></blockquote></div><br></div>