diff options
author | Eric Anholt <anholt@freebsd.org> | 2006-03-09 23:29:44 +0000 |
---|---|---|
committer | Eric Anholt <anholt@freebsd.org> | 2006-03-09 23:29:44 +0000 |
commit | 7a0f7f739804bc7d9c5562701abee8d134878977 (patch) | |
tree | bc3c80e3a230a0d41b8020103397990ae7672a83 /exa/exa_render.c | |
parent | 8a3ff42abb726d1604af39b4653ede5f760b7e69 (diff) |
Coverity #349: Fall back to software early if pSrc->pDrawable is NULL, or
pMask is non-NULL but pMask->pDrawable is NULL. This prevents NULL
dereferences on gradients and other Pictures which have no pDrawable.
Diffstat (limited to 'exa/exa_render.c')
-rw-r--r-- | exa/exa_render.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/exa/exa_render.c b/exa/exa_render.c index f45f08916..e0d9fda16 100644 --- a/exa/exa_render.c +++ b/exa/exa_render.c @@ -449,10 +449,14 @@ exaComposite(CARD8 op, Bool saveSrcRepeat = pSrc->repeat; Bool saveMaskRepeat = pMask ? pMask->repeat : 0; - if (pExaScr->swappedOut) { - exaDrawableDirty(pDst->pDrawable); - pExaScr->SavedComposite(op, pSrc, pMask, pDst, xSrc, ySrc, - xMask, yMask, xDst, yDst, width, height); + /* We currently don't support acceleration of gradients, or other pictures + * with a NULL pDrawable. + */ + if (pExaScr->swappedOut || + pSrc->pDrawable == NULL || (pMask != NULL && pMask->pDrawable == NULL)) + { + ExaCheckComposite (op, pSrc, pMask, pDst, xSrc, ySrc, + xMask, yMask, xDst, yDst, width, height); return; } @@ -462,7 +466,7 @@ exaComposite(CARD8 op, (ySrc + height) <= pSrc->pDrawable->height) pSrc->repeat = 0; - if (!pMask && pSrc->pDrawable) + if (!pMask) { if (op == PictOpSrc) { @@ -507,8 +511,7 @@ exaComposite(CARD8 op, pMask->repeat = 0; - if (pSrc->pDrawable && (!pMask || pMask->pDrawable) && - pExaScr->info->PrepareComposite && + if (pExaScr->info->PrepareComposite && !pSrc->alphaMap && (!pMask || !pMask->alphaMap) && !pDst->alphaMap) { ret = exaTryDriverComposite(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, |