summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2018-03-27 12:41:09 (GMT)
committerBrad King <brad.king@kitware.com>2018-03-27 12:46:20 (GMT)
commit27f033550a3693df67a30ce94f3c5e60a7a337ec (patch)
tree29f97dff2016efa292493814372a4d134c62db26
parent75e8af3354c42ce42abb4bece351fe1a8b99d96a (diff)
downloadCMake-27f033550a3693df67a30ce94f3c5e60a7a337ec.zip
CMake-27f033550a3693df67a30ce94f3c5e60a7a337ec.tar.gz
CMake-27f033550a3693df67a30ce94f3c5e60a7a337ec.tar.bz2
ctest_update: Fix crash when handling svn externals
Refactoring in commit v3.9.0-rc1~156^2 (c++: prefer vectors over lists, 2017-05-04) switched `cmCTestSVN::Repositories` from `std::list` to `std::vector`. This can cause re-allocation when svn externals are processed and break the `RootInfo` pointer that is supposed to point at the first repository element. Switch back to `std::list` so that the address remains stable. Fixes: #17854
-rw-r--r--Source/CTest/cmCTestSVN.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h
index dbc7fde..a467ede 100644
--- a/Source/CTest/cmCTestSVN.h
+++ b/Source/CTest/cmCTestSVN.h
@@ -8,6 +8,7 @@
#include "cmCTestGlobalVC.h"
#include <iosfwd>
+#include <list>
#include <string>
#include <vector>
@@ -70,7 +71,8 @@ private:
friend struct Revision;
// Info of all the repositories (root, externals and nested ones).
- std::vector<SVNInfo> Repositories;
+ // Use std::list so the elements don't move in memory.
+ std::list<SVNInfo> Repositories;
// Pointer to the infos of the root repository.
SVNInfo* RootInfo;