From 41156cc45dee5f23e12e78222a4c30df70ec516c Mon Sep 17 00:00:00 2001 From: Christoffer Lerno Date: Thu, 19 Sep 2024 20:50:14 +0200 Subject: [PATCH] Temp allocator overwrites data when doing reset on extra allocated pages. #1462 --- lib/std/core/allocators/temp_allocator.c3 | 1 + releasenotes.md | 1 + 2 files changed, 2 insertions(+) diff --git a/lib/std/core/allocators/temp_allocator.c3 b/lib/std/core/allocators/temp_allocator.c3 index 9d211a5cd..72ac77b46 100644 --- a/lib/std/core/allocators/temp_allocator.c3 +++ b/lib/std/core/allocators/temp_allocator.c3 @@ -68,6 +68,7 @@ fn void TempAllocator.reset(&self, usz mark) @dynamic TempAllocatorPage *last_page = self.last_page; while (last_page && last_page.mark > mark) { + self.used = last_page.mark; TempAllocatorPage *to_free = last_page; last_page = last_page.prev_page; self._free_page(to_free)!!; diff --git a/releasenotes.md b/releasenotes.md index 7680a3718..b642d75b8 100644 --- a/releasenotes.md +++ b/releasenotes.md @@ -36,6 +36,7 @@ - Crash invoking a `@body` argument with the wrong number of parameters. - Fix reordering semantics in struct assignment. - Regression when passing types as `#expr` arguments. #1461 +- Temp allocator overwrites data when doing reset on extra allocated pages. #1462 ### Stdlib changes - Additional init functions for hashmap.