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.
This commit is contained in:
Eric Anholt 2006-03-09 23:29:44 +00:00
parent 8a3ff42abb
commit 7a0f7f7398
2 changed files with 17 additions and 7 deletions

View File

@ -1,3 +1,10 @@
2006-03-09 Eric Anholt <anholt@FreeBSD.org>
* exa/exa_render.c: (exaComposite):
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.
2006-03-09 Eric Anholt <anholt@FreeBSD.org>
* exa/exa.c:

View File

@ -449,9 +449,13 @@ 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,
/* 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,