mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-23 07:28:51 -06:00
cmFindBase: Don't pass vector::erase an out of bounds iterator
Fixes: #26606
This commit is contained in:
committed by
Brad King
parent
b2674f3b38
commit
f5837f0ac9
@@ -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