diff options
author | Douglas Gregor <dgregor@apple.com> | 2014-04-30 15:49:06 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2014-04-30 15:49:06 +0000 |
commit | 3bdb9015b1226c33231794c1ace84cd5b8a7e6f3 (patch) | |
tree | 7cc92aeb99609b844538cc3a0974937ac2c8b0a3 /include/llvm | |
parent | 41fb11790562745484a1aaade7377d11d970972a (diff) | |
download | llvm-3bdb9015b1226c33231794c1ace84cd5b8a7e6f3.tar.gz llvm-3bdb9015b1226c33231794c1ace84cd5b8a7e6f3.tar.bz2 llvm-3bdb9015b1226c33231794c1ace84cd5b8a7e6f3.tar.xz |
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
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/ADT/SmallVector.h | 2 |
1 files changed, 1 insertions, 1 deletions
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<T> &SmallVectorImpl<T>::operator=(SmallVectorImpl<T> &&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. |