Rémi Bernon : ntdll: Fix handling of back pointer in heap_set_debug_flags.

Alexandre Julliard julliard at winehq.org
Tue May 31 15:57:59 CDT 2022


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

Author: Rémi Bernon <rbernon at codeweavers.com>
Date:   Mon May 30 15:14:02 2022 +0200

ntdll: Fix handling of back pointer in heap_set_debug_flags.

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
                 {




More information about the wine-cvs mailing list