Xnest: Implement xnestModifyPixmapHeader

Xnest variant of ModifyPixmapHeader that creates new Pixmap in parent X
server if it's size is modified from 0x0 to anything bigger.

xnestCreatePixmap doesn't create pixmap in parent X server if it has
dimensions 0x0. If it is later resized and accessed, Xnest will be
aborted with BadDrawable error from parent X server because it will
use XID 0. This happens with ScratchPixmap, for example as used from
XaceCensorImage. Applications using XACE crash Xnest.

Reviewed-by: Adam Jackson <ajax@redhat.com>
This commit is contained in:
Michal Srb 2013-08-06 16:56:53 +02:00 • committed by Adam Jackson
commit b902c8abb6
3 changed files with 18 additions and 0 deletions

View file

@ -78,6 +78,21 @@ xnestDestroyPixmap(PixmapPtr pPixmap)
return TRUE;
}
Bool
xnestModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
int bitsPerPixel, int devKind, pointer pPixData)
{
if(!xnestPixmapPriv(pPixmap)->pixmap && width > 0 && height > 0) {
xnestPixmapPriv(pPixmap)->pixmap =
XCreatePixmap(xnestDisplay,
xnestDefaultWindows[pPixmap->drawable.pScreen->myNum],
width, height, depth);
}
return miModifyPixmapHeader(pPixmap, width, height, depth,
bitsPerPixel, devKind, pPixData);
}
RegionPtr
xnestPixmapToRegion(PixmapPtr pPixmap)
{