summaryrefslogtreecommitdiff
path: root/exa
diff options
context:
space:
mode:
authorDodji Seketeli <dodji@seketeli.org>2007-07-17 12:12:02 +0200
committerMichel Dänzer <michel@tungstengraphics.com>2007-07-17 12:12:02 +0200
commit5657fb065cc79ba3ca5a836f45637ba9894f9abf (patch)
tree2a1f37e5e3846c25ad514a15786945e0976ef303 /exa
parentbbe7ce10fa93017374d7a4611427b70a22d7507a (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.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/exa/exa.c b/exa/exa.c
index c5b5a666a..8e22b8927 100644
--- a/exa/exa.c
+++ b/exa/exa.c
@@ -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)
{