mem: Panic when passing invalid pointers to small stack free/resize

This is consistent with `Stack_Allocator`.
This commit is contained in:
Feoramund
2025-06-14 13:49:31 -04:00
parent d7e98ba82a
commit 47a54dd11a
+2 -4
View File
@@ -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