[PATCH v2 1/6] ntdll: Fix handling of back pointer in heap_set_debug_flags.

Rémi Bernon wine at gitlab.winehq.org
Tue May 31 05:04:23 CDT 2022


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

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

diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
index 16abc158e55..7697b8f0354 100644
--- a/dlls/ntdll/heap.c
+++ b/dlls/ntdll/heap.c
@@ -1337,8 +1337,9 @@ static void heap_set_debug_flags( HANDLE handle )
                 if (block_get_flags( block ) & BLOCK_FLAG_FREE)
                 {
                     char *data = (char *)block + block_get_overhead( block ), *end = (char *)block + block_get_size( block );
-                    if (end >= commit_end) mark_block_free( data, commit_end - data, flags );
-                    else mark_block_free( data, end - sizeof(struct block *) - data, flags );
+                    if (next_block( subheap, block )) end -= sizeof(struct block *);
+                    if (end > commit_end) mark_block_free( data, commit_end - data, flags );
+                    else mark_block_free( data, end - data, flags );
                 }
                 else
                 {
-- 
GitLab


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



More information about the wine-devel mailing list