mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
589bcb2544
This prevents the following scenario where an allocation is wrongly assumed
to be part of the current head node (`node0`):
```
| node0 - - - - | node1 - - - - - - - - - - - - |
| | | | |
| | | end_index0 end_index1
| | | |
alloc0 alloc1
free(alloc1):
load node0
buf0.ptr + end_index0 == alloc1.ptr + alloc1.len ? yes!
end_index0 -= alloc1.len
| node0 - - - - | node1 - - - - - - - - - - - |
| | | |
| end_index0 end_index1
| |
alloc0
```
which could move `end_index0` *into* `alloc0` and make it possible for any
subsequent calls to `alloc` to overwrite its contents!