problem with silly CreateBitmap call

Deun deun76 at
Thu Sep 6 03:40:27 CDT 2007


I've tried the free-to-play MMORPG game called Perfect World ( ) with wine 0.9.44 and it installs fine.
However, when running it often crashed with the following error
in the x11drv traces :

trace:x11drv:X11DRV_CreateBitmap (0xed4) 2147483646x2147483646
1 bpp
X Error of failed request:  BadAlloc (insufficient resources
for operation)
  Major opcode of failed request:  53 (X_CreatePixmap)
  Serial number of failed request:  3155
  Current serial number in output stream:  3163

This occured after an attempt to load a bmp file that can't be
found anywhere.

The size of the bitmap seems crazy... So I've made a patch to
fix this in bitmap.c by setting 1x1 size in case of stupid
input instead of failing with BadAlloc. However, since it works
fine on real windows, so I'm not sure about the behaviour that
the function should have. However this patch let me run the
game now :

=== start of diff ===
--- bitmap.c.ori        2007-08-24 16:34:33.000000000 +0200
+++ bitmap.c    2007-09-06 10:27:06.000000000 +0200
@@ -141,6 +141,16 @@
     TRACE("(%p) %dx%d %d bpp\n", hbitmap, bitmap.bmWidth,
bitmap.bmHeight, bitmap.bmBitsPixel);
+       /* when launching game PerfectWorld ,
+ * there are attemps to create 7ffffffe x 7ffffffe 1 bpp
+ * so let's add a protextion against too high values */
+       if (bitmap.bmWidth >= 0x7f000000 || bitmap.bmHeight >=
+       {
+               /* fallback: allocate a default 1x1 bitmap to
avoid crash */
+               bitmap.bmWidth=1;
+               bitmap.bmHeight=1;
+       }
     if (!(physBitmap = X11DRV_init_phys_bitmap( hbitmap )))
return FALSE;
       /* Create the pixmap */
=== end of diff ===


Denis Huguet.

Building a website is a piece of cake. Yahoo! Small Business gives you all the tools to get online. 

More information about the wine-patches mailing list