From ba21d8fd5472e7c304bb65775a954a16771f7442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Bernon?= Date: Tue, 3 May 2022 18:31:28 +0200 Subject: [PATCH] ntdll: Mask block flags when computing HEAP_InsertFreeBlock size. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: RĂ©mi Bernon Signed-off-by: Alexandre Julliard --- 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 */