summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2010-09-16 10:56:10 +0200
committerJamey Sharp <jamey@minilop.net>2011-12-14 18:27:52 -0800
commit82461d4c8ebe4f071443cb0fba0e83439a6e8ba8 (patch)
treebf969a2b0e878995f44dbcdd84874d01540c3d62
parent78707a2395094daa5f46cbeeabaa95b090ef6325 (diff)
Move pixmap size limit checking to CreatePixmap, from screen hooks.pixmap-hooks
Commit by Jamey Sharp and Josh Triplett. Signed-off-by: Jamey Sharp <jamey@minilop.net> Signed-off-by: Josh Triplett <josh@joshtriplett.org> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com> Tested-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--dix/pixmap.c7
-rw-r--r--exa/exa_classic.c3
-rw-r--r--exa/exa_driver.c5
-rw-r--r--exa/exa_mixed.c5
-rw-r--r--fb/fbpixmap.c2
-rw-r--r--hw/xfree86/xaa/xaaInit.c3
6 files changed, 6 insertions, 19 deletions
diff --git a/dix/pixmap.c b/dix/pixmap.c
index 16eb5bdc4..2c13e5154 100644
--- a/dix/pixmap.c
+++ b/dix/pixmap.c
@@ -108,7 +108,12 @@ FreeScratchPixmapsForScreen(int scrnum)
PixmapPtr
CreatePixmap(ScreenPtr pScreen, int width, int height, int depth, unsigned usage_hint)
{
- PixmapPtr pPixmap = dixAllocateObjectWithPrivates(PixmapRec, PRIVATE_PIXMAP);
+ PixmapPtr pPixmap;
+
+ if (width > 32767 || height > 32767)
+ return NullPixmap;
+
+ pPixmap = dixAllocateObjectWithPrivates(PixmapRec, PRIVATE_PIXMAP);
if (!pPixmap)
return NullPixmap;
pPixmap->drawable.type = DRAWABLE_PIXMAP;
diff --git a/exa/exa_classic.c b/exa/exa_classic.c
index 5eebc0812..2a0ac9286 100644
--- a/exa/exa_classic.c
+++ b/exa/exa_classic.c
@@ -64,9 +64,6 @@ exaCreatePixmap_classic(PixmapPtr pPixmap)
Bool ret;
ExaScreenPriv(pScreen);
- if (w > 32767 || h > 32767)
- return FALSE;
-
swap(pExaScr, pScreen, CreatePixmap);
ret = pScreen->CreatePixmap (pPixmap);
swap(pExaScr, pScreen, CreatePixmap);
diff --git a/exa/exa_driver.c b/exa/exa_driver.c
index 48b9fbdfe..4aeb961fa 100644
--- a/exa/exa_driver.c
+++ b/exa/exa_driver.c
@@ -58,9 +58,6 @@ exaCreatePixmap_driver(PixmapPtr pPixmap)
size_t paddedWidth, datasize;
ExaScreenPriv(pScreen);
- if (w > 32767 || h > 32767)
- return FALSE;
-
swap(pExaScr, pScreen, CreatePixmap);
ret = pScreen->CreatePixmap(pPixmap);
swap(pExaScr, pScreen, CreatePixmap);
@@ -85,8 +82,6 @@ exaCreatePixmap_driver(PixmapPtr pPixmap)
}
else {
paddedWidth = ((w * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
- if (paddedWidth / 4 > 32767 || h > 32767)
- return FALSE;
exaSetFbPitch(pExaScr, pExaPixmap, w, h, bpp);
diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c
index 2e6eea264..851f0624a 100644
--- a/exa/exa_mixed.c
+++ b/exa/exa_mixed.c
@@ -57,9 +57,6 @@ exaCreatePixmap_mixed(PixmapPtr pPixmap)
size_t paddedWidth;
ExaScreenPriv(pScreen);
- if (w > 32767 || h > 32767)
- return FALSE;
-
swap(pExaScr, pScreen, CreatePixmap);
ret = pScreen->CreatePixmap(pPixmap);
swap(pExaScr, pScreen, CreatePixmap);
@@ -73,8 +70,6 @@ exaCreatePixmap_mixed(PixmapPtr pPixmap)
bpp = pPixmap->drawable.bitsPerPixel;
paddedWidth = ((w * bpp + FB_MASK) >> FB_SHIFT) * sizeof(FbBits);
- if (paddedWidth / 4 > 32767 || h > 32767)
- return FALSE;
/* We will allocate the system pixmap later if needed. */
pPixmap->devPrivate.ptr = NULL;
diff --git a/fb/fbpixmap.c b/fb/fbpixmap.c
index f135109dc..08bc91a3b 100644
--- a/fb/fbpixmap.c
+++ b/fb/fbpixmap.c
@@ -35,8 +35,6 @@ fbCreatePixmapBpp (PixmapPtr pPixmap, int bpp)
size_t paddedWidth;
paddedWidth = ((pPixmap->drawable.width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (FbBits);
- if (paddedWidth / 4 > 32767 || pPixmap->drawable.height > 32767)
- return FALSE;
datasize = pPixmap->drawable.height * paddedWidth;
#ifdef FB_DEBUG
datasize += 2 * paddedWidth;
diff --git a/hw/xfree86/xaa/xaaInit.c b/hw/xfree86/xaa/xaaInit.c
index b1fc8e8f4..b673a0502 100644
--- a/hw/xfree86/xaa/xaaInit.c
+++ b/hw/xfree86/xaa/xaaInit.c
@@ -340,9 +340,6 @@ XAACreatePixmap(PixmapPtr pPix)
int h = pPix->drawable.height;
int size = w * h;
- if (w > 32767 || h > 32767)
- return FALSE;
-
if (!infoRec->offscreenDepthsInitialized)
XAAInitializeOffscreenDepths (pScreen);