[PATCH] Fix ShmPutImage for XYBitmap

Julien Cristau jcristau at debian.org
Sat Nov 5 05:36:26 PDT 2011


We can't call CopyArea in that case because the image has depth 1, which
might not match the target drawable, so we might overrun the shm
segment.  Commit 11817a881cb93a89788105d1e575a468f2a8d27c apparently
fixed a similar bug for XYPixmap, but missed the bitmap case.

Fixes: http://bugs.debian.org/629611

Thanks to Alan Curry for diagnosing this and providing a test case.

Reported-by: Alan Curry <pacman at kosh.dhis.org>
Signed-off-by: Julien Cristau <jcristau at debian.org>
---
 Xext/shm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Xext/shm.c b/Xext/shm.c
index 9c8beb2..7ca027a 100644
--- a/Xext/shm.c
+++ b/Xext/shm.c
@@ -481,7 +481,7 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC,
 {
     PixmapPtr pPixmap;
 
-    if (format == ZPixmap || depth == 1) {
+    if (format == ZPixmap || (format == XYPixmap && depth == 1)) {
 	pPixmap = GetScratchPixmapHeader(dst->pScreen, w, h, depth,
 					 BitsPerPixel(depth),
 					 PixmapBytePad(w, depth),
-- 
1.7.7



More information about the xorg-devel mailing list