[PATCH 1/6] ntdll: Mask block flags when computing HEAP_InsertFreeBlock size.

Rémi Bernon wine at gitlab.winehq.org
Fri May 20 00:57:11 CDT 2022


From: Rémi Bernon <rbernon at codeweavers.com>

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
 dlls/ntdll/heap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
index 6e64d0d7dfb..8706b0f7774 100644
--- a/dlls/ntdll/heap.c
+++ b/dlls/ntdll/heap.c
@@ -586,7 +586,8 @@ static HEAP *HEAP_GetPtr(
  */
 static inline void HEAP_InsertFreeBlock( HEAP *heap, ARENA_FREE *pArena, BOOL last )
 {
-    FREE_LIST_ENTRY *pEntry = heap->freeList + get_freelist_index( pArena->size + sizeof(*pArena) );
+    SIZE_T block_size = (pArena->size & ARENA_SIZE_MASK) + sizeof(*pArena);
+    FREE_LIST_ENTRY *pEntry = heap->freeList + get_freelist_index( block_size );
     if (last)
     {
         /* insert at end of free list, i.e. before the next free list entry */
-- 
GitLab


https://gitlab.winehq.org/wine/wine/-/merge_requests/100



More information about the wine-devel mailing list