From 3bdb9015b1226c33231794c1ace84cd5b8a7e6f3 Mon Sep 17 00:00:00 2001 From: Douglas Gregor Date: Wed, 30 Apr 2014 15:49:06 +0000 Subject: Fix a use of uninitialized memory in SmallVector's move-assignment operator. When we were moving from a larger vector to a smaller one but didn't need to re-allocate, we would move-assign over uninitialized memory in the target, then move-construct that same data again. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207663 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/ADT/SmallVector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include/llvm') diff --git a/include/llvm/ADT/SmallVector.h b/include/llvm/ADT/SmallVector.h index df46f91911..dcf0354860 100644 --- a/include/llvm/ADT/SmallVector.h +++ b/include/llvm/ADT/SmallVector.h @@ -805,7 +805,7 @@ SmallVectorImpl &SmallVectorImpl::operator=(SmallVectorImpl &&RHS) { this->grow(RHSSize); } else if (CurSize) { // Otherwise, use assignment for the already-constructed elements. - this->move(RHS.begin(), RHS.end(), this->begin()); + this->move(RHS.begin(), RHS.begin()+CurSize, this->begin()); } // Move-construct the new elements in place. -- cgit v1.2.3