From 5798151a0e49e6dd4f35234fe67bb3cf59700928 Mon Sep 17 00:00:00 2001 From: Feoramund <161657516+Feoramund@users.noreply.github.com> Date: Sat, 14 Jun 2025 12:02:21 -0400 Subject: [PATCH] mem: Poison unused memory more thoroughly --- core/mem/allocators.odin | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/mem/allocators.odin b/core/mem/allocators.odin index dfb76b101..3fafde730 100644 --- a/core/mem/allocators.odin +++ b/core/mem/allocators.odin @@ -1156,6 +1156,7 @@ stack_resize_bytes_non_zeroed :: proc( data, err := stack_alloc_bytes_non_zeroed(s, size, alignment, loc) if err == nil { runtime.copy(data, byte_slice(old_memory, old_size)) + sanitizer.address_poison(old_memory) } return data, err } @@ -1165,6 +1166,8 @@ stack_resize_bytes_non_zeroed :: proc( s.curr_offset += diff // works for smaller sizes too if diff > 0 { zero(rawptr(curr_addr + uintptr(diff)), diff) + } else { + sanitizer.address_poison(old_data[size:]) } result := byte_slice(old_memory, size) ensure_poisoned(result)