From 47a54dd11aea12c72937207508b9c70a1b92f32c Mon Sep 17 00:00:00 2001 From: Feoramund <161657516+Feoramund@users.noreply.github.com> Date: Sat, 14 Jun 2025 13:49:31 -0400 Subject: [PATCH] mem: Panic when passing invalid pointers to small stack free/resize This is consistent with `Stack_Allocator`. --- core/mem/allocators.odin | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/core/mem/allocators.odin b/core/mem/allocators.odin index ee59325e2..d4f06f1af 100644 --- a/core/mem/allocators.odin +++ b/core/mem/allocators.odin @@ -1387,8 +1387,7 @@ small_stack_free :: proc( end := start + uintptr(len(s.data)) curr_addr := uintptr(old_memory) if !(start <= curr_addr && curr_addr < end) { - // panic("Out of bounds memory address passed to stack allocator (free)"); - return .Invalid_Pointer + panic("Out of bounds memory address passed to small stack allocator (free)", loc) } if curr_addr >= start+uintptr(s.offset) { // NOTE(bill): Allow double frees @@ -1543,8 +1542,7 @@ small_stack_resize_bytes_non_zeroed :: proc( end := start + uintptr(len(s.data)) curr_addr := uintptr(old_memory) if !(start <= curr_addr && curr_addr < end) { - // panic("Out of bounds memory address passed to stack allocator (resize)"); - return nil, .Invalid_Pointer + panic("Out of bounds memory address passed to small stack allocator (resize)", loc) } if curr_addr >= start+uintptr(s.offset) { // NOTE(bill): Treat as a double free