diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2017-06-21 17:02:50 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-02-05 19:17:30 +0100 |
commit | 7cd298612d189f07e0521c7177ac30164eff539c (patch) | |
tree | 4a3ed801cc9aed806cfe62fdb85f4801327a7d3e /mfbt/Vector.h | |
parent | 3fbeb6628070b6d56f13f8c816d5b279040836c7 (diff) | |
download | uxp-7cd298612d189f07e0521c7177ac30164eff539c.tar.gz |
Fix off-by-one in Vector::insert.
Diffstat (limited to 'mfbt/Vector.h')
-rw-r--r-- | mfbt/Vector.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mfbt/Vector.h b/mfbt/Vector.h index fc43afcf16..07e3704264 100644 --- a/mfbt/Vector.h +++ b/mfbt/Vector.h @@ -1232,10 +1232,10 @@ Vector<T, N, AP>::insert(T* aP, U&& aVal) } } else { T oldBack = Move(back()); - if (!append(Move(oldBack))) { /* Dup the last element. */ + if (!append(Move(oldBack))) { return nullptr; } - for (size_t i = oldLength; i > pos; --i) { + for (size_t i = oldLength - 1; i > pos; --i) { (*this)[i] = Move((*this)[i - 1]); } (*this)[pos] = Forward<U>(aVal); |