diff options
author | Dodji Seketeli <dodji@seketeli.org> | 2007-07-17 12:12:02 +0200 |
---|---|---|
committer | Michel Dänzer <michel@tungstengraphics.com> | 2007-07-17 12:12:02 +0200 |
commit | 5657fb065cc79ba3ca5a836f45637ba9894f9abf (patch) | |
tree | 2a1f37e5e3846c25ad514a15786945e0976ef303 /exa | |
parent | bbe7ce10fa93017374d7a4611427b70a22d7507a (diff) |
exaDriverInit: Fail if pScreenInfo or a member of it is invalid.
EXA may attempt to use the invalid value and crash otherwise.
Diffstat (limited to 'exa')
-rw-r--r-- | exa/exa.c | 39 |
1 files changed, 39 insertions, 0 deletions
@@ -569,6 +569,45 @@ exaDriverInit (ScreenPtr pScreen, PictureScreenPtr ps; #endif + if (!pScreenInfo) + return FALSE; + + if (!pScreenInfo->memoryBase) { + LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::memoryBase must be " + "non-zero\n", pScreen->myNum); + return FALSE; + } + + if (!pScreenInfo->memorySize) { + LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::memorySize must be " + "non-zero\n", pScreen->myNum); + return FALSE; + } + + if (pScreenInfo->offScreenBase > pScreenInfo->memorySize) { + LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::offScreenBase must be <= " + "ExaDriverRec::memorySize\n", pScreen->myNum); + return FALSE; + } + + if (!pScreenInfo->PrepareSolid) { + LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::PrepareSolid must be " + "non-NULL\n", pScreen->myNum); + return FALSE; + } + + if (!pScreenInfo->PrepareCopy) { + LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::PrepareCopy must be " + "non-NULL\n", pScreen->myNum); + return FALSE; + } + + if (!pScreenInfo->WaitMarker) { + LogMessage(X_ERROR, "EXA(%d): ExaDriverRec::WaitMarker must be " + "non-NULL\n", pScreen->myNum); + return FALSE; + } + if (pScreenInfo->exa_major != EXA_VERSION_MAJOR || pScreenInfo->exa_minor > EXA_VERSION_MINOR) { |