Bug 62341 - Xorg segfaults when starting with no monitor connected
Summary: Xorg segfaults when starting with no monitor connected
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Server/General (show other bugs)
Version: unspecified
Hardware: x86 (IA32) Linux (All)
: medium normal
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-14 13:58 UTC by Andreas Lampersperger
Modified: 2018-06-13 18:06 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
Same patch as in Description (492 bytes, text/plain)
2013-03-14 13:58 UTC, Andreas Lampersperger
no flags Details

Description Andreas Lampersperger 2013-03-14 13:58:58 UTC
Created attachment 76529 [details]
Same patch as in Description

When starting Xorg on a machine without monitor attached, Xorg segfaults when starting e.g. xrandr.

I already did some debugging and created the following patch, which fixes this problem:

Index: xorg-server-1.13.3/hw/xfree86/modes/xf86Crtc.h
===================================================================
--- xorg-server-1.13.3.orig/hw/xfree86/modes/xf86Crtc.h
+++ xorg-server-1.13.3/hw/xfree86/modes/xf86Crtc.h
@@ -730,7 +730,7 @@ static _X_INLINE xf86OutputPtr
 xf86CompatOutput(ScrnInfoPtr pScrn)
 {
     xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
-
+    if ( config->compat_output == -1 ) return NULL;
     return config->output[config->compat_output];
 }

Please add this fix to git.

Andreas
Comment 1 Adam Jackson 2018-06-13 18:06:00 UTC
commit 28159eff6badf6181b255f26d1f444abe81c05b7
Author: Jason Gerecke <killertofu@gmail.com>
Date:   Thu Apr 30 18:06:14 2015 -0700

    xfree86: Return NULL from xf86CompatOutput if no compat_output is defined
    
    If no compat_output is defined, we inadvertently (attempt to) return
    whatever data is at index -1. Instead, return NULL since that's what
    callers are expecting.
    
    Reviewed-by: Adam Jackson <ajax@redhat.com>
    Signed-off-by: Jason Gerecke <jason.gerecke@wacom.com>


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.