Vitaliy Margolen : ntdll: Take size of the arena from the current pointer before advancing.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Apr 12 10:00:08 CDT 2007


Module: wine
Branch: master
Commit: 5b4cfac3bf7a6c8df04680da73232a6b70d2ec00
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5b4cfac3bf7a6c8df04680da73232a6b70d2ec00

Author: Vitaliy Margolen <wine-patches at kievinfo.com>
Date:   Wed Apr 11 07:08:25 2007 -0600

ntdll: Take size of the arena from the current pointer before advancing.

---

 dlls/ntdll/heap.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/dlls/ntdll/heap.c b/dlls/ntdll/heap.c
index 61b25db..25aefd9 100644
--- a/dlls/ntdll/heap.c
+++ b/dlls/ntdll/heap.c
@@ -1613,7 +1613,19 @@ NTSTATUS WINAPI RtlWalkHeap( HANDLE heap, PVOID entry_ptr )
             goto HW_end;
         }
 
-        ptr += entry->cbData; /* point to next arena */
+        if (((ARENA_INUSE *)ptr - 1)->magic == ARENA_INUSE_MAGIC)
+        {
+            ARENA_INUSE *pArena = (ARENA_INUSE *)ptr - 1;
+            ptr += pArena->size & ARENA_SIZE_MASK;
+        }
+        else if (((ARENA_FREE *)ptr - 1)->magic == ARENA_FREE_MAGIC)
+        {
+            ARENA_FREE *pArena = (ARENA_FREE *)ptr - 1;
+            ptr += pArena->size & ARENA_SIZE_MASK;
+        }
+        else
+            ptr += entry->cbData; /* point to next arena */
+
         if (ptr > (char *)currentheap + currentheap->size - 1)
         {   /* proceed with next subheap */
             if (!(currentheap = currentheap->next))




More information about the wine-cvs mailing list