diff options
Diffstat (limited to 'Xext/shm.c')
-rw-r--r-- | Xext/shm.c | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/Xext/shm.c b/Xext/shm.c index fc8441c43..589ed0b4d 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -834,6 +834,19 @@ ProcPanoramiXShmGetImage(ClientPtr client) return BadMatch; } + if (format == ZPixmap) { + widthBytesLine = PixmapBytePad(w, pDraw->depth); + length = widthBytesLine * h; + } + else { + widthBytesLine = PixmapBytePad(w, 1); + lenPer = widthBytesLine * h; + plane = ((Mask) 1) << (pDraw->depth - 1); + length = lenPer * Ones(planemask & (plane | (plane - 1))); + } + + VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client); + drawables = calloc(PanoramiXNumScreens, sizeof(DrawablePtr)); if (!drawables) return BadAlloc; @@ -856,18 +869,6 @@ ProcPanoramiXShmGetImage(ClientPtr client) .depth = pDraw->depth }; - if (format == ZPixmap) { - widthBytesLine = PixmapBytePad(w, pDraw->depth); - length = widthBytesLine * h; - } - else { - widthBytesLine = PixmapBytePad(w, 1); - lenPer = widthBytesLine * h; - plane = ((Mask) 1) << (pDraw->depth - 1); - length = lenPer * Ones(planemask & (plane | (plane - 1))); - } - - VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client); xgi.size = length; if (length == 0) { /* nothing to do */ @@ -1302,9 +1303,14 @@ static int ProcShmDispatch(ClientPtr client) { REQUEST(xReq); - switch (stuff->data) { - case X_ShmQueryVersion: + + if (stuff->data == X_ShmQueryVersion) return ProcShmQueryVersion(client); + + if (!client->local) + return BadRequest; + + switch (stuff->data) { case X_ShmAttach: return ProcShmAttach(client); case X_ShmDetach: @@ -1461,9 +1467,14 @@ static int _X_COLD SProcShmDispatch(ClientPtr client) { REQUEST(xReq); - switch (stuff->data) { - case X_ShmQueryVersion: + + if (stuff->data == X_ShmQueryVersion) return SProcShmQueryVersion(client); + + if (!client->local) + return BadRequest; + + switch (stuff->data) { case X_ShmAttach: return SProcShmAttach(client); case X_ShmDetach: |