mirror of
https://github.com/boostorg/atomic.git
synced 2026-01-19 04:02:09 +00:00
Fixed pointer arithmetics in wait state initialization on reallocation.
Fixes https://github.com/boostorg/atomic/issues/72.
This commit is contained in:
@@ -7,6 +7,10 @@
|
||||
|
||||
[section:changelog Changelog]
|
||||
|
||||
[heading Boost 1.87]
|
||||
|
||||
* Fixed initialization of atomic wait state list on memory reallocation. ([github_issue 72])
|
||||
|
||||
[heading Boost 1.86]
|
||||
|
||||
* Use [@https://man.openbsd.org/OpenBSD-6.2/futex.2 `futex(2)`] system call on OpenBSD since recent OpenBSD versions have removed support for `syscall(2)`.
|
||||
|
||||
@@ -1252,11 +1252,11 @@ wait_state_list::header* wait_state_list::allocate_buffer(std::size_t new_capaci
|
||||
|
||||
const volatile void** old_a = get_atomic_pointers(old_header);
|
||||
std::memcpy(a, old_a, old_header->size * sizeof(const volatile void*));
|
||||
std::memset(a + old_header->size * sizeof(const volatile void*), 0, (new_capacity - old_header->size) * sizeof(const volatile void*));
|
||||
std::memset(a + old_header->size, 0, (new_capacity - old_header->size) * sizeof(const volatile void*));
|
||||
|
||||
wait_state** old_w = get_wait_states(old_a, old_header->capacity);
|
||||
std::memcpy(w, old_w, old_header->capacity * sizeof(wait_state*)); // copy spare wait state pointers
|
||||
std::memset(w + old_header->capacity * sizeof(wait_state*), 0, (new_capacity - old_header->capacity) * sizeof(wait_state*));
|
||||
std::memset(w + old_header->capacity, 0, (new_capacity - old_header->capacity) * sizeof(wait_state*));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user