[PATCH][libcxx] Fix AddressSanitizer false positive with vector::insert

Stefan Haller lists at haller-berlin.de
Sun Jun 28 01:06:30 PDT 2015


(First-time contributor here; please bear with me in case I’m doing something stupid.)

Here’s a patch that fixes a false positive from AddressSanitizer with vector::insert(pos, first, last). It only triggers when the iterator arguments aren’t ForwardIterators, and then only if the vector has a capacity greater than its size.

The test tries to cover not only the defect case itself (i.e. the first “for" loop of the insert method), but also the second half of the insert method, which was not broken. Not sure if you would prefer a more minimal test that only exercises the bug itself.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: asan_vector_insert.patch
Type: application/octet-stream
Size: 2383 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150628/1f65ead2/attachment.obj>


More information about the llvm-commits mailing list