afcbbe2
From: Kristian Høgsberg <krh@redhat.com>
afcbbe2
Date: Sun, 28 Oct 2007 09:37:52 +0100
afcbbe2
Subject: [PATCH] Fix crash in xf86InitOrigins()
mharris 3a3aa5e
afcbbe2
In a multihead setup, if only the first screen can be
afcbbe2
initialized, but the second screen is mentioned first in the
afcbbe2
ServerLayout section, the xf86InitOrigins() function will crash
afcbbe2
because the screen referred to in the e.g. "RightOf" part is
afcbbe2
non-existent.
mharris 3a3aa5e
afcbbe2
---
afcbbe2
--- a/hw/xfree86/common/xf86Cursor.c.init-origins-fix	2004-10-18 22:22:42.675899006 -0400
afcbbe2
+++ b/hw/xfree86/common/xf86Cursor.c	2004-10-18 22:21:42.540867549 -0400
mharris 3a3aa5e
@@ -566,6 +566,14 @@
mharris 3a3aa5e
 
mharris 3a3aa5e
 	    screen = &xf86ConfigLayout.screens[i];
mharris 3a3aa5e
 
mharris 3a3aa5e
+	    if (screen->refscreen != NULL &&
mharris 3a3aa5e
+		screen->refscreen->screennum >= xf86NumScreens) {
mharris 3a3aa5e
+		screensLeft &= ~(1 << i);
mharris 3a3aa5e
+	        xf86Msg(X_WARNING, "Not including screen \"%s\" in origins calculation.\n",
mharris 3a3aa5e
+			screen->screen->id);
mharris 3a3aa5e
+	        continue;
afcbbe2
+	    }
mharris 3a3aa5e
+
mharris 3a3aa5e
 	    switch(screen->where) {
mharris 3a3aa5e
 	    case PosObsolete:
mharris 3a3aa5e
 		OldStyleConfig = TRUE;