Bugzilla – Attachment #49158: Latest patch? for bug #113227
int depth;
{
PixmapPtr pPixmap;
int datasize;
size_t datasize;
int paddedWidth;
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)
paddedWidth = PixmapBytePad(width, depth);
if (paddedWidth / 4 > 32767 || height > 32767)
datasize = height * paddedWidth;
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;
DevUnion *ppriv;
unsigned *sizes;
unsigned size;
size_t alloc;
int i;
if (pScreen->totalPixmapSize > ((size_t)-1) - pixDataSize)
pPixmap = (PixmapPtr)xalloc(pScreen->totalPixmapSize + pixDataSize);
fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth,
int adjust;
int base;
paddedWidth = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (FbBits);
#ifdef PIXPRIV
base = pScreen->totalPixmapSize;
XAAPixmapPtr pPriv;
PixmapPtr pPix = NULL;
int size = w * h;
if (w > 32767 || h > 32767)
if (!infoRec->offscreenDepthsInitialized)
XAAInitializeOffscreenDepths (pScreen);
int depth ;
register PixmapPtr pPixmap = (PixmapPtr)NULL;
int size ;
size_t size ;
TRACE(("xf4bppCreatePixmap(pScreen=0x%x, width=%d, height=%d,
return (PixmapPtr) NULL ;
size = PixmapBytePad(width, depth);
if (size / 4 > 32767 || height > 32767)
pPixmap = AllocatePixmap (pScreen, (height * size));
if ( !pPixmap )
int ipad=INTER_PLANES*2 - 1;
paddedWidth = (paddedWidth + ipad) & ~ipad;
if (depth != 1)