Rémi Bernon : ntdll: Mask block flags when computing HEAP_InsertFreeBlock size.

Alexandre Julliard julliard at winehq.org
Fri May 20 15:26:48 CDT 2022


Module: wine
Branch: master
Commit: ba21d8fd5472e7c304bb65775a954a16771f7442
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=ba21d8fd5472e7c304bb65775a954a16771f7442

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Tue May  3 18:31:28 2022 +0200

ntdll: Mask block flags when computing HEAP_InsertFreeBlock size.

Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 */




More information about the wine-cvs mailing list