Commit f353fd88 authored by Stefan Eilemann's avatar Stefan Eilemann Committed by Wouter van Oortmerssen

Fix pointer underrun when allocating large vectors

Change-Id: Ia69fc3098468eb64420215dc1068342ccbbb1ede
parent c9a840e9
...@@ -367,7 +367,7 @@ class vector_downward { ...@@ -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_);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment