aboutsummaryrefslogtreecommitdiff
path: root/core/mem
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2023-08-16 12:02:21 +0100
committerGitHub <noreply@github.com>2023-08-16 12:02:21 +0100
commit2153cb7e0a97f05d06caa3ed2ee8131dc5d4e4bb (patch)
treec7ad7c190f36d3c543614cce2a2f0fde1dc4be8c /core/mem
parent15033eab28d8261e65addb70d931d514a73530c7 (diff)
parent7e4a65114a9140e403eeae8d4e321098a25d2e0e (diff)
Merge pull request #2721 from Kartoffelsaft/dynamic-pool-alloc
Return .Invalid_Argument in pool allocator to avoid potential segfaults
Diffstat (limited to 'core/mem')
-rw-r--r--core/mem/allocators.odin1
1 files changed, 1 insertions, 0 deletions
diff --git a/core/mem/allocators.odin b/core/mem/allocators.odin
index 77cdfb3cf..b6a296322 100644
--- a/core/mem/allocators.odin
+++ b/core/mem/allocators.odin
@@ -749,6 +749,7 @@ dynamic_pool_alloc_bytes :: proc(p: ^Dynamic_Pool, bytes: int) -> ([]byte, Alloc
n := bytes
extra := p.alignment - (n % p.alignment)
n += extra
+ if n > p.block_size do return nil, .Invalid_Argument
if n >= p.out_band_size {
assert(p.block_allocator.procedure != nil)
memory, err := p.block_allocator.procedure(p.block_allocator.data, Allocator_Mode.Alloc,