diff options
| author | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2025-06-14 12:03:53 -0400 |
|---|---|---|
| committer | Feoramund <161657516+Feoramund@users.noreply.github.com> | 2025-06-15 12:34:15 -0400 |
| commit | 8f68c464676a87c8e8c664af0e35998bc33f3acd (patch) | |
| tree | 7de7f5754269dfc65cb8ed7e360580197b3d72f6 /core/mem | |
| parent | 5798151a0e49e6dd4f35234fe67bb3cf59700928 (diff) | |
mem: Don't unpoison the header of a `Small_Stack` allocation
Diffstat (limited to 'core/mem')
| -rw-r--r-- | core/mem/allocators.odin | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/core/mem/allocators.odin b/core/mem/allocators.odin index 3fafde730..09072f905 100644 --- a/core/mem/allocators.odin +++ b/core/mem/allocators.odin @@ -1329,7 +1329,7 @@ This procedure allocates `size` bytes of memory aligned to a boundary specified by `alignment`. The allocated memory is not explicitly zero-initialized. This procedure returns a slice of the allocated memory region. */ -@(require_results) +@(require_results, no_sanitize_address) small_stack_alloc_bytes_non_zeroed :: proc( s: ^Small_Stack, size: int, @@ -1349,8 +1349,10 @@ small_stack_alloc_bytes_non_zeroed :: proc( s.offset += padding next_addr := curr_addr + uintptr(padding) header := (^Small_Stack_Allocation_Header)(next_addr - size_of(Small_Stack_Allocation_Header)) - sanitizer.address_unpoison(header) header.padding = auto_cast padding + // We must poison the header, no matter what its state is, because there + // may have been an out-of-order free before this point. + sanitizer.address_poison(header) s.offset += size s.peak_used = max(s.peak_used, s.offset) result := byte_slice(rawptr(next_addr), size) |