Bug 16301 - Missing Screen line in ServerLayout crashes the server
Summary: Missing Screen line in ServerLayout crashes the server
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/General (show other bugs)
Version: 6.8.99.902 (6.9 RC2)
Hardware: All All
: medium minor
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-10 18:01 UTC by Georgi Mirchev
Modified: 2008-07-03 06:28 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
Example xorg.conf to produce the error (1.62 KB, text/plain)
2008-06-10 18:01 UTC, Georgi Mirchev
no flags Details
0001-xfree86-return-an-error-if-Screen-is-missing-from-S.patch (1.23 KB, patch)
2008-06-29 04:16 UTC, Peter Hutterer
no flags Details | Splinter Review
0001-xfree86-handle-missing-Screen-lines-in-the-ServerLa.patch (1.94 KB, patch)
2008-06-30 21:23 UTC, Peter Hutterer
no flags Details | Splinter Review

Description Georgi Mirchev 2008-06-10 18:01:54 UTC
Created attachment 17042 [details]
Example xorg.conf to produce the error

If in the "ServerLayout" section there is no Screen option the server crashes upon start.

The segfault happens in xf86Init.c at this line:
   GDevPtr configured_device = xf86ConfigLayout.screens->screen->device;

Expected behavior is to produce an descriptive error message.
Comment 1 Peter Hutterer 2008-06-29 04:16:39 UTC
Created attachment 17451 [details] [review]
0001-xfree86-return-an-error-if-Screen-is-missing-from-S.patch

Return an error when trying to parse the config file and no screen has been specified in the layout.
Comment 2 Julien Cristau 2008-06-30 09:11:02 UTC
> --- Comment #1 from Peter Hutterer <peter@cs.unisa.edu.au>  2008-06-29 04:16:39 PST ---
> Return an error when trying to parse the config file and no screen has been
> specified in the layout.
> 
can't we create a default Screen section (as in the autoconfig case) if
there isn't one in ServerLayout?
Comment 3 Peter Hutterer 2008-06-30 21:23:34 UTC
Created attachment 17469 [details] [review]
0001-xfree86-handle-missing-Screen-lines-in-the-ServerLa.patch

how about this one then?

If no Screen is specified in the ServerLayout section, either take the first
one from the config file or autogenerate a default screen.
Comment 4 Georgi Mirchev 2008-07-01 00:03:06 UTC
Comment on attachment 17469 [details] [review]
0001-xfree86-handle-missing-Screen-lines-in-the-ServerLa.patch

This patch has an obvious bug: The second "if" will never succeed.
Comment 5 Peter Hutterer 2008-07-01 00:57:59 UTC
> This patch has an obvious bug: The second "if" will never succeed.

are you referring to the second if (!count)?
count is modified in the while loop between the two hunks (and reset to 0
before that), so the condition that if count == 0 no screen was specified is
correct.
Comment 6 Georgi Mirchev 2008-07-01 03:50:43 UTC
I see. I was looking at the patch only.
Comment 7 Peter Hutterer 2008-07-03 06:28:50 UTC
pushed as fe5cf7cb00fd926cefff933adbdbceea7353f4c2


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.