Fix pointer underrun when allocating large vectors

Change-Id: Ia69fc3098468eb64420215dc1068342ccbbb1ede
This commit is contained in:
Stefan Eilemann 2015-02-10 13:54:22 +01:00 committed by Wouter van Oortmerssen
parent c9a840e935
commit f353fd8864
1 changed files with 1 additions and 1 deletions

View File

@ -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_);