Another bugfix, dlls/msvcrt/heap.c

Gerald Pfeifer gerald at pfeifer.com
Mon Dec 3 15:56:37 CST 2007


This is another real bugfix where the old checking code simply failed to
work.  It least it turns out my quest finds (and fixes) real bugs. ;-)

Gerald

ChangeLog:
Fix error handling in _aligned_offset_realloc().

Index: dlls/msvcrt/heap.c
===================================================================
RCS file: /home/wine/wine/dlls/msvcrt/heap.c,v
retrieving revision 1.24
diff -u -3 -p -r1.24 heap.c
--- dlls/msvcrt/heap.c	28 Nov 2007 14:03:28 -0000	1.24
+++ dlls/msvcrt/heap.c	3 Dec 2007 21:42:25 -0000
@@ -443,13 +443,14 @@ void * CDECL _aligned_offset_realloc(voi
         /* It seems this function was called with an invalid pointer. Bail out. */
         return NULL;
     }
+
     /* Adjust old_size to get amount of actual data in old block. */
-    old_size -= old_padding;
-    if (old_size < 0)
+    if (old_size < old_padding)
     {
         /* Shouldn't happen. Something's weird, so bail out. */
         return NULL;
     }
+    old_size -= old_padding;
 
     temp = MSVCRT_realloc(*saved, size + alignment + sizeof(void *));
 



More information about the wine-patches mailing list