| author | |
| committer | |
| log | b5bcbf2a62aa513022fdb12df75699308f87b7bc |
| tree | 53598c368c9d3d6824ee4911ae97be5ba4323735 |
| parent | a9d18c4a0c2be3d5e7dcedbedc32a9998b1e5515 |
| signature |
If we've allocated the very last page in the address space then these operations
will overflow and underflow respectively - which is fine.1 files changed, 1 insertions(+), 1 deletions(-)
lib/std/heap/debug_allocator.zig+1-1| ... | ... | @@ -266,7 +266,7 @@ pub fn DebugAllocator(comptime config: Config) type { |
| 266 | 266 | canary: usize = config.canary, |
| 267 | 267 | |
| 268 | 268 | fn fromPage(page_addr: usize, slot_count: usize) *BucketHeader { |
| 269 | const unaligned = page_addr + page_size - bucketSize(slot_count); | |
| 269 | const unaligned = page_addr +% page_size -% bucketSize(slot_count); | |
| 270 | 270 | return @ptrFromInt(unaligned & ~(@as(usize, @alignOf(BucketHeader)) - 1)); |
| 271 | 271 | } |
| 272 | 272 |