Module: wine Branch: master Commit: 74b04b763397dc06620863ea97c8cab2304c7d45 URL: https://gitlab.winehq.org/wine/wine/-/commit/74b04b763397dc06620863ea97c8cab...
Author: Paul Gofman pgofman@codeweavers.com Date: Thu May 11 22:08:07 2023 -0600
ntdll: Fix last block detection in heap_walk_blocks().
---
dlls/ntdll/heap.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c index 54aa1a8960d..ce3419734ee 100644 --- a/dlls/ntdll/heap.c +++ b/dlls/ntdll/heap.c @@ -2399,7 +2399,6 @@ BOOLEAN WINAPI RtlValidateHeap( HANDLE handle, ULONG flags, const void *ptr ) return ret; }
- static NTSTATUS heap_walk_blocks( const struct heap *heap, const SUBHEAP *subheap, const struct block *block, struct rtl_heap_entry *entry ) { @@ -2423,8 +2422,8 @@ static NTSTATUS heap_walk_blocks( const struct heap *heap, const SUBHEAP *subhea entry->lpData = (char *)block + block_get_overhead( block ); entry->cbData = block_get_size( block ) - block_get_overhead( block ); /* FIXME: last free block should not include uncommitted range, which also has its own overhead */ - if (!contains( blocks, commit_end - (char *)blocks, block, block_get_size( block ) )) - entry->cbData = commit_end - (char *)entry->lpData - 4 * BLOCK_ALIGN; + if (!contains( blocks, commit_end - 4 * BLOCK_ALIGN - (char *)blocks, block, block_get_size( block ) )) + entry->cbData = commit_end - 4 * BLOCK_ALIGN - (char *)entry->lpData; entry->cbOverhead = 2 * BLOCK_ALIGN; entry->iRegionIndex = 0; entry->wFlags = 0;