Fix pointer underrun when allocating large vectors
Change-Id: Ia69fc3098468eb64420215dc1068342ccbbb1ede
This commit is contained in:
parent
c9a840e935
commit
f353fd8864
|
@ -367,7 +367,7 @@ class vector_downward {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *make_space(size_t len) {
|
uint8_t *make_space(size_t len) {
|
||||||
if (buf_ > cur_ - len) {
|
if (len > static_cast<size_t>(cur_ - buf_)) {
|
||||||
auto old_size = size();
|
auto old_size = size();
|
||||||
reserved_ += std::max(len, growth_policy(reserved_));
|
reserved_ += std::max(len, growth_policy(reserved_));
|
||||||
auto new_buf = allocator_.allocate(reserved_);
|
auto new_buf = allocator_.allocate(reserved_);
|
||||||
|
|
Loading…
Reference in New Issue