042ccfb
From: Kristian Høgsberg <krh@redhat.com>
042ccfb
Date: Sun, 28 Oct 2007 09:37:52 +0100
042ccfb
Subject: [PATCH] Fix crash in xf86InitOrigins()
mharris 3a3aa5e
042ccfb
In a multihead setup, if only the first screen can be
042ccfb
initialized, but the second screen is mentioned first in the
042ccfb
ServerLayout section, the xf86InitOrigins() function will crash
042ccfb
because the screen referred to in the e.g. "RightOf" part is
042ccfb
non-existent.
mharris 3a3aa5e
042ccfb
---
042ccfb
--- a/hw/xfree86/common/xf86Cursor.c.init-origins-fix	2004-10-18 22:22:42.675899006 -0400
042ccfb
+++ 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;
042ccfb
+	    }
mharris 3a3aa5e
+
mharris 3a3aa5e
 	    switch(screen->where) {
mharris 3a3aa5e
 	    case PosObsolete:
mharris 3a3aa5e
 		OldStyleConfig = TRUE;