font bugfix

Ove Kaaven ovek at arcticnet.no
Thu Jul 3 20:54:37 CDT 2003


While debugging C&C Generals, I found a bug responsible for some memory
corruption. I decided to check whether it had been fixed in Wine (and
was a bit surprised to find it hasn't been, considering all that XRender
work and all). I may as well submit it here, since this isn't exactly
WineX core technology.

Log:
Ove Kaaven <ovek at transgaming.com>
Fixed a memory allocation/corruption bug when growing the font cache.

Index: graphics/x11drv/xfont.c
===================================================================
RCS file: /home/wine/wine/graphics/x11drv/xfont.c,v
retrieving revision 1.114
diff -u -r1.114 xfont.c
--- graphics/x11drv/xfont.c	18 Jun 2003 19:45:22 -0000	1.114
+++ graphics/x11drv/xfont.c	4 Jul 2003 01:43:03 -0000
@@ -2848,7 +2848,7 @@
 	    TRACE("\tgrowing font cache from %i to %i\n", fontCacheSize, prev_i );
 
 	    if( (newCache = (fontObject*)HeapReAlloc(GetProcessHeap(), 0,
-						     fontCache, prev_i)) )
+						     fontCache, prev_i * sizeof(fontObject))) )
 	    {
 		i = fontCacheSize;
 		fontCacheSize  = prev_i;





More information about the wine-patches mailing list