Fix rare crash due to invalid pointer when vector::resize reallocate underlying memory (#15877)

This commit is contained in:
Noisyfox
2026-09-26 16:52:29 -03:00
committed by GitHub
parent 0ddc730854
commit 5ae9015c82
+6 -3
View File
@@ -697,7 +697,8 @@ public:
}
} else {
// Resize by duplicating the last value.
this->values.resize(n, this->values./*back*/front());
T v = this->values./*back*/front();
this->values.resize(n, v);
}
}
}
@@ -772,8 +773,10 @@ public:
if (this->values.empty())
this->values.resize(rhs_vec->size());
else
this->values.resize(rhs_vec->size(), this->values.front());
else {
T v = this->values.front();
this->values.resize(rhs_vec->size(), v);
}
assert(default_index.size() == rhs_vec->size());