[Cmake-commits] CMake branch, next, updated. v3.2.0-968-g1d054bf
Stephen Kelly
steveire at gmail.com
Tue Mar 10 16:25:33 EDT 2015
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via 1d054bf65c67edf290109335872943ebcf30cade (commit)
via 3ff95f3b0b1eed95aa6e4d6baa59c68a047072ea (commit)
from 737eb5caab017e16ae73d9ce53ab566bda04e891 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=1d054bf65c67edf290109335872943ebcf30cade
commit 1d054bf65c67edf290109335872943ebcf30cade
Merge: 737eb5c 3ff95f3
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Tue Mar 10 16:25:33 2015 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Mar 10 16:25:33 2015 -0400
Merge topic 'cmAlgorithms-early-return' into next
3ff95f3b cmAlgorithms: Add early return in cmRemoveIndices.
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=3ff95f3b0b1eed95aa6e4d6baa59c68a047072ea
commit 3ff95f3b0b1eed95aa6e4d6baa59c68a047072ea
Author: Stephen Kelly <steveire at gmail.com>
AuthorDate: Thu Mar 5 23:14:27 2015 +0100
Commit: Stephen Kelly <steveire at gmail.com>
CommitDate: Tue Mar 10 21:20:58 2015 +0100
cmAlgorithms: Add early return in cmRemoveIndices.
Avoid derefencing the iterator and segfaulting if the range
is empty.
diff --git a/Source/cmAlgorithms.h b/Source/cmAlgorithms.h
index b9d7e78..be57da3 100644
--- a/Source/cmAlgorithms.h
+++ b/Source/cmAlgorithms.h
@@ -237,6 +237,11 @@ typename Range::const_iterator cmRemoveIndices(Range& r, InputRange const& rem)
{
typename InputRange::const_iterator remIt = rem.begin();
typename InputRange::const_iterator remEnd = rem.end();
+ const typename Range::iterator rangeEnd = r.end();
+ if (remIt == remEnd)
+ {
+ return rangeEnd;
+ }
typename Range::iterator writer = r.begin();
std::advance(writer, *remIt);
@@ -244,7 +249,6 @@ typename Range::const_iterator cmRemoveIndices(Range& r, InputRange const& rem)
typename InputRange::value_type prevRem = *remIt;
++remIt;
size_t count = 1;
- const typename Range::iterator rangeEnd = r.end();
for ( ; writer != rangeEnd && remIt != remEnd; ++count, ++remIt)
{
std::advance(pivot, *remIt - prevRem);
-----------------------------------------------------------------------
Summary of changes:
Source/cmAlgorithms.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list