[compiler-rt] r196112 - [sanitizer] Allow InternalMmapVector construction with zero capacity.
Alexey Samsonov
samsonov at google.com
Tue Dec 3 01:27:08 PST 2013
On Mon, Dec 2, 2013 at 7:41 PM, Sergey Matveev <earthdok at google.com> wrote:
> Author: smatveev
> Date: Mon Dec 2 09:41:04 2013
> New Revision: 196112
>
> URL: http://llvm.org/viewvc/llvm-project?rev=196112&view=rev
> Log:
> [sanitizer] Allow InternalMmapVector construction with zero capacity.
>
> Modified:
> compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
>
> Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h
> URL:
> http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h?rev=196112&r1=196111&r2=196112&view=diff
>
> ==============================================================================
> --- compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h (original)
> +++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_common.h Mon Dec 2
> 09:41:04 2013
> @@ -320,8 +320,7 @@ template<typename T>
> class InternalMmapVector {
> public:
> explicit InternalMmapVector(uptr initial_capacity) {
> - CHECK_GT(initial_capacity, 0);
> - capacity_ = initial_capacity;
+ capacity_ = Min(initial_capacity, (uptr)1);
>
Really?
This code will also crash if you try to mmap 0-sized vector. I've fixed
this and added a test in r196263.
> size_ = 0;
> data_ = (T *)MmapOrDie(capacity_ * sizeof(T), "InternalMmapVector");
> }
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
--
Alexey Samsonov, MSK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20131203/617ae1d6/attachment.html>
More information about the llvm-commits
mailing list