From ae87b536155207e6e28b68963593a7ab09792e08 Mon Sep 17 00:00:00 2001 From: Keith Packard Date: Sat, 15 Mar 2014 23:53:53 -0700 Subject: [PATCH] dix: Allow NULL stipple in ChangeGC miOpqStipDrawable resets the stipple after painting. When that stipple was NULL, ChangeGC needs to handle that and not crash. Signed-off-by: Keith Packard Signed-off-by: Eric Anholt Reviewed-off-by: Eric Anholt --- dix/gc.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dix/gc.c b/dix/gc.c index efe6d60..88d6501 100644 --- a/dix/gc.c +++ b/dix/gc.c @@ -261,12 +261,14 @@ ChangeGC(ClientPtr client, GC * pGC, BITS32 mask, ChangeGCValPtr pUnion) case GCStipple: NEXT_PTR(PixmapPtr, pPixmap); - if ((pPixmap->drawable.depth != 1) || - (pPixmap->drawable.pScreen != pGC->pScreen)) { + if (pPixmap && ((pPixmap->drawable.depth != 1) || + (pPixmap->drawable.pScreen != pGC->pScreen))) + { error = BadMatch; } else { - pPixmap->refcnt++; + if (pPixmap) + pPixmap->refcnt++; if (pGC->stipple) (*pGC->pScreen->DestroyPixmap) (pGC->stipple); pGC->stipple = pPixmap; -- 2.7.4