From 7a0555e9bb59d02816803a1100f807d2d29f31d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Sun, 28 Oct 2007 09:37:52 +0100 Subject: [PATCH] Fix crash in xf86InitOrigins() In a multihead setup, if only the first screen can be initialized, but the second screen is mentioned first in the ServerLayout section, the xf86InitOrigins() function will crash because the screen referred to in the e.g. "RightOf" part is non-existent. --- hw/xfree86/common/xf86Cursor.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c index 9e6e62216..3ea1b4d91 100644 --- a/hw/xfree86/common/xf86Cursor.c +++ b/hw/xfree86/common/xf86Cursor.c @@ -558,6 +558,14 @@ xf86InitOrigins(void) screen = &xf86ConfigLayout.screens[i]; + if (screen->refscreen != NULL && + screen->refscreen->screennum >= xf86NumScreens) { + screensLeft &= ~(1 << i); + xf86Msg(X_WARNING, "Not including screen \"%s\" in origins calculation.\n", + screen->screen->id); + continue; + } + switch(screen->where) { case PosObsolete: OldStyleConfig = TRUE;