mirror of
https://github.com/boostorg/container.git
synced 2025-08-01 21:44:27 +02:00
Fixes #151 ("Buffer overflow in monotonic_buffer_resource::do_allocate").
This commit is contained in:
@@ -1329,6 +1329,7 @@ use [*Boost.Container]? There are several reasons for that:
|
||||
* [@https://github.com/boostorg/container/issues/145 GitHub #145: ['"Allocations not handled correctly in some cases of vector move with unequal allocators"]].
|
||||
* [@https://github.com/boostorg/container/pull/146 GitHub #146: ['"Changes for Embarcadero C++ clang-based compilers, targeting Boost 1.74. Addition needed for Embarcardero clang-based compilers"]].
|
||||
* [@https://github.com/boostorg/container/pull/148 GitHub #148: ['"Fix static initialization issues in pmr global resources"]].
|
||||
* [@https://github.com/boostorg/container/issues/151 GitHub #151: ['"Buffer overflow in monotonic_buffer_resource::do_allocate"]].
|
||||
|
||||
[endsect]
|
||||
|
||||
|
@@ -141,6 +141,9 @@ void* monotonic_buffer_resource::do_allocate(std::size_t bytes, std::size_t alig
|
||||
//See if there is room in current buffer
|
||||
std::size_t aligner = 0u;
|
||||
if(this->remaining_storage(alignment, aligner) < bytes){
|
||||
//The new buffer will be aligned to the strictest alignment so reset
|
||||
//the aligner, which was needed for the old buffer.
|
||||
aligner = 0u;
|
||||
//Update next_buffer_size to at least bytes
|
||||
this->increase_next_buffer_at_least_to(bytes);
|
||||
//Now allocate and update internal data
|
||||
|
Reference in New Issue
Block a user