Bug #594: CAN-2005-2495: Fix exploitable integer overflow in pixmap
creation, where we could create a far smaller pixmap than we thought,
allowing changes to arbitrary chunks of memory. (Søren Sandmann
Pedersen)
This commit is contained in:
@@ -36,12 +36,14 @@ PixmapPtr
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user