mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-10-11 23:43:58 +03:00
cmFindBase: Don't pass vector::erase an out of bounds iterator
Fixes: #26606
This commit is contained in:
1 parent
b2674f3b38
commit
f5837f0ac9
1 file changed
+4
-2
@@ -356,14 +356,16 @@ struct entry_to_remove
|
||||
{
|
||||
if (this->valid()) {
|
||||
long to_skip = this->count;
|
||||
long index_to_remove = 0;
|
||||
size_t index_to_remove = 0;
|
||||
for (auto const& path : entries) {
|
||||
if (path == this->value && --to_skip == 0) {
|
||||
break;
|
||||
}
|
||||
++index_to_remove;
|
||||
}
|
||||
entries.erase(entries.begin() + index_to_remove);
|
||||
if (index_to_remove < entries.size() && to_skip == 0) {
|
||||
entries.erase(entries.begin() + index_to_remove);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user