Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 18 Sep 2005 03:54:02 +0000
From:      Robert Backhaus <robbak@gmail.com>
To:        bob self <bobself@charter.net>
Cc:        freebsd-x11@freebsd.org, freebsd-current@freebsd.org, gerald@freebsd.org
Subject:   Re: can't run wine anymore
Message-ID:  <d44995805091720546c78a453@mail.gmail.com>
In-Reply-To: <200509180329.58967.dejan.lesjak@ijs.si>
References:  <432AF297.80203@charter.net> <d44995805091717573ac55124@mail.gmail.com> <200509180329.58967.dejan.lesjak@ijs.si>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
On 9/18/05, Dejan Lesjak <dejan.lesjak@ijs.si> wrote:
> On Sunday 18 of September 2005 02:57, Robert Backhaus wrote:
> > On 9/16/05, bob self <bobself@charter.net> wrote:
> > > I'm running 6.0 beta 4 and after doing a nightly portupgrade a couple of
> > > nights ago I can no longer run
> > > wine. Six ports upgraded sucessfully, including xorg-server. I get this
> > > message now when I run wine:
> > >
> > > X Error of failed request:  BadAlloc (insufficient resources for
> > > operation) Major opcode of failed request:  53 (X_CreatePixmap)
> > >   Serial number of failed request:  12785
> > >   Current serial number in output stream:  12787
> > > X Error of failed request:  BadAlloc (insufficient resources for
> > > operation) Major opcode of failed request:  53 (X_CreatePixmap)
> > >   Serial number of failed request:  12785
> > >   Current serial number in output stream:  12787
> > >
> > > Does anyone know what this means or what is causing it?
> >
> > It's in the wine bug list, see the link below. Many people are working
> > on it. It seems to be caused by an xorg upgrade. There are many people
> > working on a fix, so it shouldn't take long. According to the bug
> > report, removing that patch resolves the issue. (It appears to be the
> > file "files/patch-CAN-2005-2495". I'll try it soon.  I'm cc-ing
> > gerald, the wine maintainer, and the x11 maillist.
> >
> > http://bugs.winehq.org/show_bug.cgi?id=3336
> 
> Can you please try replacing patch-CAN-2005-2495 with the attached one (also
> at http://www.ijs.si/~lesi/xorg/patch-CAN-2005-2495-take2). This is the
> version that was actually committed to Xorg CVS.
> 
> 
> Dejan

Dejan and I have been working on this, and have got wine working
succesfully by replacing patch-CAN-2005-2495 with
http://www.ijs.si/~lesi/xorg/patch-CAN-2005-2495-aligned , which is
also attatched.

the updated patch should be commited to the port shortly.

[-- Attachment #2 --]
--- programs/Xserver/afb/afbpixmap.c.orig	Fri Apr 23 20:59:39 2004
+++ programs/Xserver/afb/afbpixmap.c	Sun Sep 18 04:56:02 2005
@@ -73,10 +73,14 @@
 	int				depth;
 {
 	PixmapPtr pPixmap;
-	int datasize;
-	int paddedWidth;
+	size_t datasize;
+	size_t paddedWidth;
 
 	paddedWidth = BitmapBytePad(width);
+
+	if (paddedWidth > 32767 || height > 32767 || depth > 4)
+	    return NullPixmap;
+	
 	datasize = height * paddedWidth * depth;
 	pPixmap = AllocatePixmap(pScreen, datasize);
 	if (!pPixmap)
--- programs/Xserver/cfb/cfbpixmap.c.orig	Fri Apr 23 21:00:12 2004
+++ programs/Xserver/cfb/cfbpixmap.c	Sun Sep 18 04:56:02 2005
@@ -70,10 +70,13 @@
     int		depth;
 {
     PixmapPtr pPixmap;
-    int datasize;
-    int paddedWidth;
+    size_t datasize;
+    size_t paddedWidth;
 
     paddedWidth = PixmapBytePad(width, depth);
+
+    if (paddedWidth / 4 > 32767 || height > 32767)
+	return NullPixmap;
     datasize = height * paddedWidth;
     pPixmap = AllocatePixmap(pScreen, datasize);
     if (!pPixmap)
--- programs/Xserver/dix/dispatch.c.orig	Mon Dec 13 02:23:05 2004
+++ programs/Xserver/dix/dispatch.c	Sun Sep 18 04:56:02 2005
@@ -1506,6 +1506,23 @@
 	client->errorValue = 0;
         return BadValue;
     }
+    if (stuff->width > 32767 || stuff->height > 32767)
+    {
+	/* It is allowed to try and allocate a pixmap which is larger than
+	 * 32767 in either dimension. However, all of the framebuffer code
+	 * is buggy and does not reliably draw to such big pixmaps, basically
+	 * because the Region data structure operates with signed shorts
+	 * for the rectangles in it.
+	 *
+	 * Furthermore, several places in the X server computes the
+	 * size in bytes of the pixmap and tries to store it in an
+	 * integer. This integer can overflow and cause the allocated size
+	 * to be much smaller.
+	 *
+	 * So, such big pixmaps are rejected here with a BadAlloc
+	 */
+	return BadAlloc;
+    }
     if (stuff->depth != 1)
     {
         pDepth = pDraw->pScreen->allowedDepths;
--- programs/Xserver/dix/pixmap.c.orig	Fri Apr 23 21:04:44 2004
+++ programs/Xserver/dix/pixmap.c	Sun Sep 18 04:56:02 2005
@@ -126,6 +126,9 @@
     unsigned size;
     int i;
 
+    if (pScreen->totalPixmapSize > ((size_t)-1) - pixDataSize)
+	return NullPixmap;
+    
     pPixmap = (PixmapPtr)xalloc(pScreen->totalPixmapSize + pixDataSize);
     if (!pPixmap)
 	return NullPixmap;
--- programs/Xserver/fb/fbpixmap.c.orig	Mon Aug  9 05:40:50 2004
+++ programs/Xserver/fb/fbpixmap.c	Sun Sep 18 04:56:02 2005
@@ -32,12 +32,14 @@
 fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp)
 {
     PixmapPtr	pPixmap;
-    int		datasize;
-    int		paddedWidth;
+    size_t	datasize;
+    size_t	paddedWidth;
     int		adjust;
     int		base;
 
     paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (FbBits);
+    if (paddedWidth / 4 > 32767 || height > 32767)
+	return NullPixmap;
     datasize = height * paddedWidth;
 #ifdef PIXPRIV
     base = pScreen->totalPixmapSize;
--- programs/Xserver/hw/xfree86/xaa/xaaInit.c.orig	Fri Jul 30 22:30:56 2004
+++ programs/Xserver/hw/xfree86/xaa/xaaInit.c	Sun Sep 18 04:56:02 2005
@@ -498,6 +498,9 @@
     XAAPixmapPtr pPriv;
     PixmapPtr pPix = NULL;
     int size = w * h;
+
+    if (w > 32767 || h > 32767)
+	return NullPixmap;
     
     if (!infoRec->offscreenDepthsInitialized)
 	XAAInitializeOffscreenDepths (pScreen);
--- programs/Xserver/hw/xfree86/xf4bpp/ppcPixmap.c.orig	Fri Apr 23 21:54:17 2004
+++ programs/Xserver/hw/xfree86/xf4bpp/ppcPixmap.c	Sun Sep 18 04:56:02 2005
@@ -85,7 +85,7 @@
     int		depth ;
 {
     register PixmapPtr pPixmap  = (PixmapPtr)NULL;
-    int size ;
+    size_t size ;
     
     TRACE(("xf4bppCreatePixmap(pScreen=0x%x, width=%d, height=%d, depth=%d)\n", pScreen, width, height, depth)) ;
 
@@ -93,6 +93,10 @@
 	return (PixmapPtr) NULL ;
 
     size = PixmapBytePad(width, depth);
+
+    if (size / 4 > 32767 || height > 32767)
+	return (PixmapPtr) NULL ;
+    
     pPixmap = AllocatePixmap (pScreen, (height * size));
     
     if ( !pPixmap )
--- programs/Xserver/ilbm/ilbmpixmap.c.orig	Fri Apr 23 21:54:22 2004
+++ programs/Xserver/ilbm/ilbmpixmap.c	Sun Sep 18 04:56:02 2005
@@ -75,10 +75,12 @@
 	int				depth;
 {
 	PixmapPtr pPixmap;
-	int datasize;
-	int paddedWidth;
+	size_t datasize;
+	size_t paddedWidth;
 
 	paddedWidth = BitmapBytePad(width);
+	if (paddedWidth > 32767 || height > 32767 || depth > 4)
+		return NullPixmap;
 	datasize = height * paddedWidth * depth;
 	pPixmap = AllocatePixmap(pScreen, datasize);
 	if (!pPixmap)
--- programs/Xserver/iplan2p4/iplpixmap.c.orig	Fri Apr 23 21:54:24 2004
+++ programs/Xserver/iplan2p4/iplpixmap.c	Sun Sep 18 04:56:02 2005
@@ -74,12 +74,14 @@
     int		depth;
 {
     PixmapPtr pPixmap;
-    int datasize;
-    int paddedWidth;
+    size_t datasize;
+    size_t paddedWidth;
     int ipad=INTER_PLANES*2 - 1;
 
     paddedWidth = PixmapBytePad(width, depth);
     paddedWidth = (paddedWidth + ipad) & ~ipad;
+    if (paddedWidth / 4 > 32767 || height > 32767)
+	return NullPixmap;
     datasize = height * paddedWidth;
     pPixmap = AllocatePixmap(pScreen, datasize);
     if (!pPixmap)
--- programs/Xserver/mfb/mfbpixmap.c.orig	Fri Nov 14 17:48:57 2003
+++ programs/Xserver/mfb/mfbpixmap.c	Sun Sep 18 04:56:02 2005
@@ -72,12 +72,14 @@
     int		depth;
 {
     PixmapPtr pPixmap;
-    int datasize;
-    int paddedWidth;
+    size_t datasize;
+    size_t paddedWidth;
 
     if (depth != 1)
 	return NullPixmap;
     paddedWidth = BitmapBytePad(width);
+    if (paddedWidth / 4 > 32767 || height > 32767)
+	return NullPixmap;
     datasize = height * paddedWidth;
     pPixmap = AllocatePixmap(pScreen, datasize);
     if (!pPixmap)

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?d44995805091720546c78a453>